note 49768 deleted from function.msql-fetch-row by didou

From: Date: Mon, 04 Apr 2005 22:09:12 +0000
Subject: note 49768 deleted from function.msql-fetch-row by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-87463@lists.php.net to get a copy of this message
Note Submitter: und3rl1n3d at gmail dot com ---- $conn = mysql_connect('localhost','root','qwerty'); $db = mysql_select_db('suporte', $conn); $val = mysql_query("SELECT * FROM ticket", $conn); $rows = mysql_num_rows($val); for ($a = 0;$a < $rows;$a++) { $row[$a] = mysql_fetch_row($val); } This will creat a number of var's equal to the number of row's you have in the table. To get the value you'll need to use: print_r ($row[0][0]); for example: if the first field on your table is: Login, and the first entry for this field is: uNd3rL1n3d print_r ($row[0][0]); will display: uNd3rL1n3d if the second entry for this field is: phpnet print_r ($row[1][0]); will display: phpnet to display the first entry of the second field use: print_r ($row[0][1]); It took me too much time to figure out how to do this, i hope i can help someone.

« previous php.notes (#87463) next »