Sunday, 15 July 2012

how can mysql_query print more than one row in php/mySql? -



how can mysql_query print more than one row in php/mySql? -

this question has reply here:

how retrieve multiple rows database in php 4 answers

i have next php code:

<?php $connect = mysql_connect("localhost","root","") or die("couldn't connect!"); mysql_select_db("cdcol") or die("there no databases name"); $query = "select * cds"; $result = mysql_query($query); $record = mysql_fetch_array($result); print_r($record); ?>

and reason (you tell me why...) output of code is:

array ( [0] => beauty [titel] => beauty [1] => ryuichi sakamoto [interpret] => ryuichi sakamoto [2] => 1990 [jahr] => 1990 [3] => 1 [id] => 1 )

namely, instead of getting table, getting first row of it. suggestions?

thank you

the mysql_fetch_array() gives 1 row @ time.

php documentation: mysql_fetch_array

you have create loop , loop on mysql result:

while ($row = mysql_fetch_array($query)) { print_r($row); }

php mysql

No comments:

Post a Comment