PHP Not Inserting Variable Into mySQL Query -


i having trouble getting 1 of variable inserted mysql query. here query string:

$strshipmethodinfo = "select bammdd, bayy, baxxx, ordnum, shpnum, \"shipment method\", \"shipment status\" shppmthd bammdd = " . $bammdd . " , bayy = " . $bayy . " , baxxx = " . $baxxx . " , shpnum = " . $arrshippinginfo[$x]['shpnum'] . " , ordnum = '" . $ordnum . "' order shpnum"; 

i using $arrshippinginfo[$x]['shpnum'] in query similar, , putting variable in one. however, when query, comes blank. other values (bammdd, bayy, baxxx, etc.) put in, variable shpnum not put in.

i have tried can think of, thinking might quote in wrong place, have been unsuccessful. please me figure out? thanks.

edit: did print_r on string, , printed twice... once shpnum correctly inserted , once blank. turns out logic error in loop using (i needed run query each shipment in order). < somehow got changed <= once changed worked. thank responses.

i there wrong how accessing array value, either $x variable, or in how passing in raw array value string (hard without rest of code: try assigning $shpnum , putting $shpnum statement?).

within code try running an:

echo $x; echo $arrshippinginfo[$x]['shpnum']; var_dump($arrshippinginfo); 

and should able find issue.

using dummy data statement , running code through on end as:

<?php  $bammdd = 'bamddd'; $bayy = 'bayy'; $baxxx = 'baxxx'; $arrshippinginfo[0]['shpnum'] = '54'; $ordnum = 555;  $x = 0; $strshipmethodinfo = "select bammdd, bayy, baxxx, ordnum, shpnum, \"shipment method\", \"shipment status\" shppmthd bammdd = " . $bammdd . " , bayy = " . $bayy . " , baxxx = " . $baxxx . " , shpnum = " . $arrshippinginfo[$x]['shpnum'] . " , ordnum = '" . $ordnum . "' order shpnum";  echo "<pre>$strshipmethodinfo</pre>"; ?> 

produces:

select bammdd, bayy, baxxx, ordnum, shpnum, "shipment method", "shipment status" shppmthd bammdd = bamddd , bayy = bayy , baxxx = baxxx , shpnum = 54 , ordnum = '555' order shpnum


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -