Brian W Posted October 21, 2008 Share Posted October 21, 2008 I have a form that sends the data to this page for processing. <?php require_once('../../Connections/Epm.php'); ?> <?php //Check If Internal $url = $_SERVER['HTTP_REFERER']; $URLP = (parse_url($url)); if($URLP['host'] <> $Site) { die('This form will not work from an external address.'); } //$Site is defined in my connection page along with a few other global variables. ?> <?php include("../includes/functions.php"); check("1 2");//This is a function I built that checks user's access levels... 1 and 2 are both admin levels. //Variables $Username = "'".$_POST['Username']."'"; $Email = "'".$_POST['Email']."'"; $Address = "'".$_POST['Username']." <".$_POST['Email'].">,'"; $Level = "'".$_POST['Level']."'"; $ID = $_POST['ID']; //SQL mysql_select_db($database_Epm, $Epm); $sql = "UPDATE `bexusers` SET Username=".$Username." Email=".$Email." Address= ".$Address." Level= ".$Level." Where ID= ".$ID; $Update = mysql_query($sql, $Epm) or die(mysql_error()); header('Location: .././?P=Users'); ?> I get 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 'Email='[email protected]' Address= 'User Name <[email protected]>,' ' at line 1 I think it has to do with the @ sign, but can't figure out why, how, or what to do. Any input is much appreciated. Link to comment https://forums.phpfreaks.com/topic/129418-solved-update-sytax-probly-easy/ Share on other sites More sharing options...
revraz Posted October 21, 2008 Share Posted October 21, 2008 $sql = "UPDATE `bexusers` SET Username='$Username', Email='$Email', Address= '$Address', Level= '$Level' Where ID= $ID"; Link to comment https://forums.phpfreaks.com/topic/129418-solved-update-sytax-probly-easy/#findComment-670967 Share on other sites More sharing options...
Brian W Posted October 21, 2008 Author Share Posted October 21, 2008 That worked, thanks revraz. My dumb @$$ forgot the commas because I'm a newb to hand writing the sql. I used to use Dreamweaver for doing this stuff but I've come to find that DW isn't very efficient and I the code it makes is often hard to read and/or hard to customize to particular needs. Plus, it'll be better in the future if I know by heart the syntax. I used the ".$Variable." there, which as worked for me in the past... is there any advantage (besides being a shorter way) to placing the variables like you did? Again, thank you. Link to comment https://forums.phpfreaks.com/topic/129418-solved-update-sytax-probly-easy/#findComment-670989 Share on other sites More sharing options...
revraz Posted October 21, 2008 Share Posted October 21, 2008 Just easier and less code. Link to comment https://forums.phpfreaks.com/topic/129418-solved-update-sytax-probly-easy/#findComment-670990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.