View Single Post
Old 11-04-2012, 03:57 PM   PM User | #1
qwertyjjj
New Coder

 
Join Date: Dec 2007
Posts: 59
Thanks: 1
Thanked 0 Times in 0 Posts
qwertyjjj is an unknown quantity at this point
cannot use mysql_fetch_array no error

I am trying to echo out the resultset but I just get the text error:
"Can't use resultset" from the die command (in bold below)
Any ideas what could be wrong?

Code:
<?php

/////////////////////////////////////////////////////////
//1. INTEGRITY CHECK SCRIPT IN CASE OF LOST CONNECTIONS
////////////////////////////////////////////////////////

//conn 1
$squid_conn_int = mysql_connect("mysqlxxxx.xxxxxxx.com",
                            "user",
                            "pw");
	if (!$squid_conn_int)
	  {
		  mail('aaaa@aaaaa.com', 'IntegrityCheck script error', mysql_error().' error');
		  die('Could not connect: ' . mysql_error());
	  }

//EXISTING PENDING ORDERS
//-------------------------
//check for paypal hack where order is confirmed ok but no validation

$db_selected = mysql_select_db("user", $squid_conn_int) or die ('Can\'t use database: ' . mysql_error());

$query = "
SELECT o.orders_id, o.orders_status, osh.comments
FROM orders o
INNER JOIN orders_status_history osh ON osh.orders_id = o.orders_id
AND osh.orders_status_id =1
AND o.orders_status =3
ORDER BY o.orders_id DESC ";

$result = mysql_query($query) or die(mysql_error());
echo "<table>";

while ($squid = mysql_fetch_array($result, MYSQL_ASSOC) 
				 or die ('Can\'t use resultset: ' . mysql_error())
) {

	$oid = $squid['o.orders_id'];
	$ocomments = $squid['osh.comments'];
	echo "<tr>";
	echo "<td>".$squid['o.orders_id']."</td><td>".$squid['o.orders_status']."</td><td>".$squid['osh.comments']."</td>";
	echo "</tr>";



}
echo "</table>";
	
?>
qwertyjjj is offline   Reply With Quote