Re: Help me learn! with an explanation of these two functions.

From: Date: Wed, 06 Nov 2002 10:05:43 +0000
Subject: Re: Help me learn! with an explanation of these two functions.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-122957@lists.php.net to get a copy of this message
On Wednesday 06 November 2002 16:52, Steve Jackson wrote: > Ok this is starting to get complex! (For me anyway) > This is my 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); According to your query it should return a single result (assuming your orderid is unique -- and it should be), and that single result contains a single field called "orderid". Use print_r($row) to see exactly what it contains (good for reference and debugging). extract($row) would assign to $orderid the value of $row['orderid'] (ie $orderid = $row['orderid']) ... > $orderid = $row; ... thus, I don't know why you have this line here. Remove it. > $query2 = "SELECT * FROM orders WHERE orderid=\"$orderid\""; This fails because $row is an array and you assigned that to $orderid. > What does extract do? I am under the assumption it extracts row > information so why a datatype error? rtfm for details and examples. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "Take that, you hostile sons-of-bitches!" -- James Coburn, in the finale of _The_President's_Analyst_ */

« previous php.general (#122957) next »