RE: [PHP] Help me learn! with an explanation of these two functions.
| From: | Steve Jackson | Date: | Wed, 06 Nov 2002 08:52:24 +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-122949@lists.php.net to get a copy of this message | ||
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);
$orderid = $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));
}
}
The SQL works Ok. At least I get no errors now.
It's my PHP to display the SQL I think I get a result of 8 errors with
the following message.
Warning: Wrong datatype in call to extract() in
/www/u1255/eadmin/eshop_fns.php on line 40.
Where line 40 is:
extract(mysql_fetch_array($result2));
I am trying to display the message on another page using:
<? include ('eshop_fns.php');
get_order_numbers();
$ship_name = $result2["ship_name"];
echo "tests and $ship_name"; ?>
What does extract do? I am under the assumption it extracts row
information so why a datatype error?
Any pointers?