Jump to content

my first sql syntax issue


wright67uk

Recommended Posts

Im a bit stuck with the syntax on my query line.  Im a newbie looking for some help or advice.

Should i put brackets around the actual query?

Many thanks.

 

$confirm = $_GET['Id'];
echo $confirm;
echo "<p>complete</p>";
$query =mysql_query "UPDATE treesurgeons SET confirmed = 'Yes' WHERE Id = $confirm";
echo mysql_error();
?></body></html>

Link to comment
https://forums.phpfreaks.com/topic/228536-my-first-sql-syntax-issue/
Share on other sites

Try:

 

$conn = mysql_connect("localhost", "your_db_name", "your_db_pass") or die(mysql_error());
$confirm = $_GET['Id'];
$query =mysql_query "UPDATE treesurgeons SET confirmed = 'Yes' WHERE Id = $confirm";
$sql_result = mysql_query ($query, $conn ) or die ('MySQL query error: '.$query);

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.