Query will not work - SOLVED
| From: | Ethan Rosenberg, PhD | Date: | Sun, 03 Feb 2013 02:08:29 +0000 |
| Subject: | Query will not work - SOLVED | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-48674@lists.php.net to get a copy of this message | ||
I must be missing something fundamental!!
Here is a code snippet:
$sql13 = " UPDATE Customers SET Lname = 'Barnet', City = 'Lakewood', State = 'NJ' WHERE Cust_Num = 1089";
$result13 = mysqli_query($cxn, "UPDATE Customers SET Lname = 'Bleich', City = 'Lakewood', State = 'NJ' WHERE Cust_Num = 1089");
if($row_cnt = mysqli_num_rows($result13)!= 0)
{
$row_cnt = mysqli_num_rows($result13);
echo "row count result13 is $row_cnt<br />";
}
else
{
echo "Ouch result13<br />";
}
mysqli_free_result($result13);
$sql1 = "select Cust_Num, Fname, Lname, Street, City, State, Zip, Phone, Notes from Customers order by Cust_Num";
$result1 = mysqli_query($cxn, $sql1);
if($row_cnt = mysqli_num_rows($result1)!= 0)
{
$row_cnt = mysqli_num_rows($result1);
echo "Row count result1 is $row_cnt<br />";
}
else
{
echo "Ouch result1<br />";
}
Here are my results:
Ouch result13
Row count result1 is 45
What am I doing wrong??
Ethan
=============
I was using the "worker@localhost", which did not have the Update privilege. Added the privilege that, and everything worked.
Sorry for bothering you with trivia.
Ethan