Finally I have it! Cheers to all that helped. I was querying twice when I didn't need to and as Jason said not doing anything with the extracted information. This code works and displays data nicely. function get_order_numbers() { $conn = db_connect(); $query = "select * from orders, email where orders.orderid = email.orderid and email.checked='no'"; $result = mysql_query($query) or die("Error: cannot select orderid<BR>$query<BR>".mysql_error()); while( $row = mysql_fetch_array($result)) { extract($row); if (is_array($row)) //print_r($row); { //echo "tests and "; echo $row["orderid"]; echo $row["ship_name"]; } } }
Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 > -----Original Message----- > From: Jason Wong [mailto:php-general@;gremlins.com.hk] > Sent: 7. marraskuuta 2002 10:06 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Help me learn! with an explanation of > these two functions. > > > On Thursday 07 November 2002 15:15, Steve Jackson wrote: > > My second query still doesn't return anything? Even with $orderid = > > $row removed as Jason suggested. > > What exactly do you mean by "doesn't return anything"? > > a) Does the second query fail? > b) Do you get any errors? > > If no to both (a) and (b) then your query succeeded. > > Now, your code below as-is does not do anything with the 2nd > query results. > You've only used extract() on it, which by itself is not much > use, unless you > use the variables that has been extracted. Read my previous > post about what > extract() does (and read the manual for heaven's sake) > > Also make liberal use of print_r() to see what values your > variables contain > at different stages of your program. > > > This is my current function. > > > > > > function get_order_numbers() > > { > > $conn = db_connect(); > > $query = "select orders.orderid from orders, email where > > orders.orderid = email.orderid and email.checked='no'"; $result = > > mysql_query($query) or die("Error: cannot select > > orderid<BR>$query<BR>".mysql_error()); > > while( $row = mysql_fetch_array($result)) > > { > > extract($row); > > //$orderid = $row; > > print_r($row); > > $query2 = "SELECT * FROM orders WHERE orderid=\"$orderid\""; > > $result2 = mysql_query($query2) or die("Error: cannot fetch > > order<BR>$query2<BR>".mysql_error()); > > extract(mysql_fetch_array($result2)); > > } > > } > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications > Development * > > /* > One Bell System - it works. > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php