You have an error in your SQL syntax near...
Posted: Fri Sep 23, 2005 6:10 pm
feyd | Please use
Thanks so much
Marcel
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Okay so when i run this script I get the following error: "You have an error in your SQL syntax near 'key = xxx' at line 1" It does everything it is supposed to do but update the keymail table used value to "5". Anyone know what is wrong?Code: Select all
<?php
$email=$_POST['email'];
//Connect to database with connection script file
require 'includes/db_connect.php';
//used is not equal to zero
$sql="SELECT * FROM keymail WHERE used != '0' LIMIT 1";
$query=mysql_query($sql);
$result=mysql_fetch_object($query);
echo ("Thank you for purchasing a CD key your key is $result->key . You will also recieve an e-mail with this cd key, thank you again.");
$message="Your cd key is $result->key . Thank you again.";
$headers='From: myself@now.com'."\r\n" . ' Reply-To: stillme@now.com' ."\r\n";
$subject="Thank you for your purchase.";
mail($email,$subject,$message,$headers);
$secondsql="UPDATE keymail SET used='5' WHERE key = $result->key";
$secondquery=mysql_query($secondsql)
or die(mysql_error());
?>Thanks so much
Marcel
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]