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?

$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'";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.