Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Problem Querying Multiple Rows

Codes here !

Moderators: macek, egami, gesf

Problem Querying Multiple Rows

Postby nbasso713 » Wed Dec 26, 2012 3:15 pm

All I'm trying to do is create an array with all the id's that have a value of 0 in the status column of the table.

Code: Select all
$query = mysql_query("SELECT `tempID` FROM `pending` WHERE `status` = 0");
$status = mysql_fetch_array($query);


This codes has only been returning a single row any ideas?
nbasso713
New php-forum User
New php-forum User
 
Posts: 15
Joined: Sat Dec 10, 2011 4:00 pm

Re: Problem Querying Multiple Rows

Postby nbasso713 » Wed Dec 26, 2012 4:04 pm

SOLVED

Created a while loop

Code: Select all
while ($row = mysql_fetch_array($query, MYSQL_NUM)) {
     $status[$i] =  $row[0];
     $i++;
}
nbasso713
New php-forum User
New php-forum User
 
Posts: 15
Joined: Sat Dec 10, 2011 4:00 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.