Jump to content

[SOLVED] query help


adamlacombe

Recommended Posts

I keep getting this error:

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`status`) values('') where id='1'' at line 1

 

and this is what my query is:

<?
include "db.php";

mysql_query("UPDATE settings set (`status`) values('$status') where id='1'") or die(mysql_error());
echo '<div class=\'msg\'>Settings updated</div><p>';
?>

 

Whats wrong with the query?

Link to comment
https://forums.phpfreaks.com/topic/164150-solved-query-help/
Share on other sites

still not working..

 

This is what I have:

<?
include "db.php";

if($_POST['submit']){
mysql_query("UPDATE settings SET `status` = '$status' where id=1") or die(mysql_error());
echo '<div class=\'msg\'>Settings updated</div><p>';
}else{

echo'
<table>
<form action="settings.php" method="POST">
<tr>
<td class="content">Status:</td>
<td class="content"><input name="status" type="text" size="50"></td>
</tr>

<td class="content" colspan="4">
<input type="submit" name="submit" id="submit" value="Submit Changes">
</td>
</tr>
</table></form>';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/164150-solved-query-help/#findComment-865907
Share on other sites

That's because there is no code settings $status to anything (damn those register_globals and all the wasted time they have caused.)

 

I share the same feelings.

 

oh, DUH. lol. thanks!

 

A reminder that you should never use shorthand () PHP tags for a couple reasons but mainly portability.  Use full <?php opening tags.

Link to comment
https://forums.phpfreaks.com/topic/164150-solved-query-help/#findComment-865945
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.