Query does not work

From: Date: Tue, 01 Jul 2014 04:13:39 +0000
Subject: Query does not work
Groups: php.db 
Request: Send a blank email to php-db+get-48890@lists.php.net to get a copy of this message
Dear List - Here is a query: select Lname, Fname, Payments, Charges, Balance from Customers, Charges where (Charges.Cust_Num = Customers.Cust_Num) and (Customers.Cust_Num =1022); Works beautifully from the terminal. In the php script: $sql31= "select Lname, Fname, Payments, Charges, Balance from Customers, Charges where (Charges.Cust_Num = Customers.Cust_Num) " . "and (Customers.Cust_Num =1022)"; if (!mysqli_query($cxn, $sql31)) printf("Errormessage: %s\n", mysqli_error($cxn)); I know something is wrong, since the output is "Errormessage:, however, the error is not stated. Dr. Google also has no ideas. He only says "if (!mysqli_query($cxn, $sql31)) printf("Errormessage: %s\n", mysqli_error($cxn));" I also know that the data base connection is OK, since $cxn = mysqli_connect($host,$user,$password); if (!$cxn) { die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } if (mysqli_select_db($cxn, "Store") == 0) { printf("Errormessage: %s\n", mysqli_error($cxn)); die(); } and I ran a previous query which outputted the correct data. TIA Ethan

« previous php.db (#48890) next »