0

SOLVED ALREADY!!!

i'm getting the following error:
UPDATE orders SET naamwijn = Josep Masasch Blanc de Blancs Brut Cava WHERE ordernr = 22 AND productnr = 16 LIMIT 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Masasch Blanc de Blancs Brut Cava WHERE ordernr = 22 AND productnr = 16 LIMIT 1' at line 1

and the code is as following:

$query = "SELECT orders.productnr, wijnen.naam, orders.naamwijn  FROM wijnen INNER JOIN orders ON orders.productnr = wijnen.id WHERE orders.ordernr = '$temp'";

$result = mysql_query($query) or die(mysql_error());

while(list($iddd, $wijnnaam, $naamwijn) = mysql_fetch_array($result, MYSQL_NUM))

{         

            if($naamwijn == ""){

                        $wijnnaam = mysql_real_escape_string($wijnnaam);

                        $q = "UPDATE orders SET naamwijn = '$wijnnaam' WHERE ordernr = '$temp' AND productnr = '$iddd'";

                        echo $q;

                        $r = mysql_query($q) or die (mysql_error());

            }

}

it seems like it's splitting the first variable... anyone knows how i can fix this?

Edited by thijscream: n/a

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by thijscream
0

$q = "UPDATE orders SET naamwijn = '$wijnnaam' WHERE ordernr = '$temp' AND productnr = '$iddd'";

should have been
$q = "UPDATE orders SET naamwijn = '".$wijnnaam."' WHERE ordernr = '$temp' AND productnr = '$iddd'";

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.