Re: [PHP-DB] Query will not work - SOLVED

2013-02-02 Thread tamouse mailing lists
On Sat, Feb 2, 2013 at 8:08 PM, Ethan Rosenberg, PhD
 wrote:
> I  must be missing something fundamental!!

Yes.

> I was using the "worker@localhost", which did not have the Update privilege.
> Added the privilege that, and everything worked.

Please explain why you are not checking error returns from function calls?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Query will not work - SOLVED

2013-02-02 Thread Karl DeSaulniers
$sql13 = "UPDATE `Customers` SET `Lname` = 'Barnet',  `City` =  
'Lakewood',  `State` = 'NJ' WHERE `Cust_Num` = 1089";


$result13 = mysqli_query($cxn, $sql13);

if(mysqli_num_rows($result13)> 0)
{
  $row_cnt = mysqli_num_rows($result13);
  echo "row count result13 is $row_cnt";
}

else
{
echo "Ouch result13";
}

mysqli_free_result($result13);

$sql1 = "select * FROM `Customers` ORDER BY `Cust_Num`";

$result1 = mysqli_query($cxn, $sql1);

if(mysqli_num_rows($result1)> 0)
{
$row_cnt = mysqli_num_rows($result1);
echo "Row count result1 is $row_cnt";
}

else
{
echo "Ouch result1";
}

Try that..

Best,
Karl


On Feb 2, 2013, at 8:08 PM, Ethan Rosenberg, PhD wrote:


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";
}

else
{
echo "Ouch result13";
}

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";
}

else
{
echo "Ouch result1";
}

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



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Query will not work - SOLVED

2013-02-02 Thread Ethan Rosenberg, PhD

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";
}

else
{
echo "Ouch result13";
}

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";
}

else
{
echo "Ouch result1";
}

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



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php