Update mysql

I have this code and is working until i hit submit and i get this error Warning: mysql_query() expects parameter 1 to be string, resource given in C:\xampp\htdocs\PhpProject1\ssssssssssssss.php on line 49(line 23 here)
[php]

    <select name="autorii" form="autor" >
<?php $con = mysql_connect("localhost", "root", ""); if (!$con) die('Could not connect: ' . mysql_error()); mysql_select_db("try", $con); $sql = "SELECT * FROM incerc"; $result = mysql_query($sql,$con); echo "----Alegeti nume----\n"; while($row = mysql_fetch_array($result)) { echo "".$row['nume']."\n"; } echo ""; if(isset($_GET['submit'])) { $blbl=$_GET['autorii']; echo $blbl ; mysql_query($con,"UPDATE incerc SET autor='1' WHERE nume='".$blbl."'"); } mysql_close($con); ?>

[/php]

You have the parameter’s backwards…

This:

[php] mysql_query($con,“UPDATE incerc SET autor=‘1’ WHERE nume=’”.$blbl."’");[/php]

Should be:

[php] mysql_query(“UPDATE incerc SET autor=‘1’ WHERE nume=’”.$blbl."’",$con);[/php]

con isnt needed at all really.

Sponsor our Newsletter | Privacy Policy | Terms of Service