Altrea wrote:Does the value inside that variable contain a whitespace at the end so that the where clause will never match?
Not that I can see...I changed the print line:
- Code: Select all
print ":" . $r_bowlcode . ":<br />";
to show the entire value, I get:
:Ash08-005 :
Record Updated
:Ash13-002 :
Record Updated
:Ash14-001 :
Record Updated
:Blacklimba14-001 :
Record Updated
I also checked the entry in the table, there are no spaces or white-space visible.
I added some code to see if the $r_bowlcode really exists,
- Code: Select all
$sql="SELECT txtProductBowlCode,intProductID FROM tblsplintersbowlinventory WHERE txtProductBowlCode='$r_bowlcode'";
if ($result=mysqli_query($con,$sql))
{
while ($row=mysqli_fetch_row($result))
{
printf ("%s (%s)\n",$row[0],$row[1]);
}
mysqli_free_result($result);
}
This gives me the same - with no printout of the record data...
however, if I remove the
- Code: Select all
WHERE txtProductBowlCode='$r_bowlcode'
I get:
:Ash08-005 :
Ash08-005 :
:Ash07-001: (246) :AshWenge07-001: (260) :AshWenge07-002: (261) :Ash07-004: (247) :Ash07-005: (248) :AshSc07-006: (250) :AshSc07-007: (251) :AshSc07-008: (252) :AshSc07-009: (253) ...
And yes, the "Ash08-005 (503) " does show up...and there is no white-space...
So...it appears the problem is the way the variable is referred to in the WHERE clause of the statement.
I've tried to find an example of WHERE used with a variable, and I must not be asking Google the correct question. What IS the variable syntax?
==================================================
Edit to add: IF I change the WHERE phrase to ask for the first bowl specifically:
- Code: Select all
WHERE txtProductBowlCode='Ash08-005'
I get:
:Ash08-005 :
:Ash08-005: (503) Record Updated
:Ash13-002 :
:Ash08-005: (503) Record Updated
So it is
DEFINITELY the syntax on the variable...