RE: [PHP] Help me learn! with an explanation of these two functions.

From: Date: Thu, 07 Nov 2002 07:15:16 +0000
Subject: RE: [PHP] Help me learn! with an explanation of these two functions.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123114@lists.php.net to get a copy of this message
My second query still doesn't return anything? Even with $orderid = $row removed as Jason suggested. 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)); } } > > What I want the function to do is say OK where the orderid's > > match pull out all the address details for each orderid and display > > what I want displayed accordingly. At the moment I get this array > > returned by using print_r($row). Array ( [0] => 100040 [orderid] => > > 100040 ) Array ( [0] => 100041 [orderid] => 100041 ) Array ( [0] => > > 100043 [orderid] => 100043 ) Array ( [0] => 100044 > [orderid] => 100044 > > ) Array ( [0] => 100046 [orderid] => 100046 ) Array ( [0] => 100050 > > [orderid] => 100050 ) Array ( [0] => 100051 [orderid] => 100051 ) > > Array ( [0] => 100052 [orderid] => 100052 ) > > > > Where do I go from here? > > Well, like I said in my previous post if you remove the line: > > $orderid = $row; > > then your second query *should* work. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications > Development *

« previous php.general (#123114) next »