Hi,
Please have a look at these 2 sql statements. Have commented under the 2nd as I am puzzled why the 2nd one does not run when I choose 2 variables to query.
Can any one shed some light ? THanks !
$result = mysql_query("SELECT * FROM `Visit_Report` WHERE Visitid= $a ");
$myrow = mysql_fetch_array($result);
$customer = $myrow["Company"];
$last = $myrow["Lastname"];
list($customer0, $customer1) = explode(",", $customer);
echo $customer0;
echo $customer1;
// This works perfectly without errors
$sql1 = "SELECT * FROM `Customers` WHERE `Company` = '$customer0' ";
$result1 = mysql_query($sql1) or die (mysql_error());
$myrow1 = mysql_fetch_array($result1);
$street = $myrow1["Street"];
//This too works without a problem.
BUT, if I modify this to
$sql1 = "SELECT * FROM `Customers` WHERE `Company` = '$customer0' && `Lastname` = '$last' ";
echo $sql1;
$result1 = mysql_query($sql1) or die (mysql_error());
$myrow1 = mysql_fetch_array($result1);
$street = $myrow1["Street"];
print_r($myrow1); // returns blank screen
print_r($myrow1); // returns all values in 1st sql
The query does not run although it echoes out correctly.. Clearly no problem with field names sicne the 1st version goes thru...I use ver 3.23.53 of mysql.
Please advise !