Re: MySQL Select

From: Date: Wed, 23 May 2001 14:23:06 +0000
Subject: Re: MySQL Select
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54068@lists.php.net to get a copy of this message
Hi This is what I always do... 1. for one row (saved in array $reihe)... $bla = "SELECT * FROM table WHERE id = '$something''';
        // db is your database connection
$test = mysql_query($bla, $db);
        // you dont have to use the if...i do that to check if anything was returned
if ($reihe = mysql_fetch_row($test)) {
        echo $reihe[0] . $reihe[1];
} //this will output field one and two of the queried row 2. to get several rows in an array: $bla = "SELECT * FROM table''';
        // db is your database connection
$test = mysql_query($bla, $db); while ($reihe = mysql_fetch_array($test)) {
        echo $reihe[0];
} //this will output the first field of all rows in this table - Nessi - (heh my first contribution to the mailing list! woohooo) ;))) At 14:32 23/05/01 +0100, you wrote:
ok...sorry to ask a stupid question but.... $result = mysql_query("SELECT jazz FROM funk WHERE foo='bar'") but where do you go from there. How would you iterate through the array a row at a time, doing your thing as you go along? thanks, jamie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#54068) next »