dlyles Posted December 1, 2006 Share Posted December 1, 2006 I swear I'm going to get this together and eliminate the need for simple post. In the meantime, can someone tell me what's wrong with this?[code]$mygroup=$_COOKIE['group'];$partname=mysql_real_escape_string($_POST['partname']);$newquery="select * from parts where PartName = '" . $partname . "'";$newresult=mysql_query($newquery);$balance = $row['balance'] - mysql_real_escape_string($_POST['amountreceived'])'; $sql = "insert into parts (GroupID, ModelID, PartName, Cost, balance) VALUES ('" . $mygroup . "', '" . $mymodel . "', '" . mysql_real_escape_string($_POST['partname']) . "', '" . mysql_real_escape_string($_POST['cost']) . "', '" . $balance . "')"; $nresult = mysql_query($nsql) or die("Error 2: query: $nsql<br>" . mysql_error());[/code]the error is in the $mygroup value. Link to comment https://forums.phpfreaks.com/topic/29138-me-and-this-syntax-issue/ Share on other sites More sharing options...
kenrbnsn Posted December 1, 2006 Share Posted December 1, 2006 What error are you getting?Ken Link to comment https://forums.phpfreaks.com/topic/29138-me-and-this-syntax-issue/#findComment-133591 Share on other sites More sharing options...
dlyles Posted December 1, 2006 Author Share Posted December 1, 2006 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/opt/data/rgbdata/apache/htdocs/receiveaction.php on line 24Line 24 is[code] VALUES ('" . $mygroup . [/code] Link to comment https://forums.phpfreaks.com/topic/29138-me-and-this-syntax-issue/#findComment-133592 Share on other sites More sharing options...
craygo Posted December 1, 2006 Share Posted December 1, 2006 wight want to try it like this[code] $sql = "insert into parts (GroupID, ModelID, PartName, Cost, balance) VALUES ('".$mygroup."', '".$mymodel."', '".mysql_real_escape_string($_POST['partname'])."', '".mysql_real_escape_string($_POST['cost'])."', '".$balance."')";[/code]Same think but why would you enter right in the middle of the insert?? Link to comment https://forums.phpfreaks.com/topic/29138-me-and-this-syntax-issue/#findComment-133615 Share on other sites More sharing options...
dlyles Posted December 1, 2006 Author Share Posted December 1, 2006 Same error :( Link to comment https://forums.phpfreaks.com/topic/29138-me-and-this-syntax-issue/#findComment-133622 Share on other sites More sharing options...
craygo Posted December 1, 2006 Share Posted December 1, 2006 echo your sql statement and see if $mygroup is there[code] $sql = "insert into parts (GroupID, ModelID, PartName, Cost, balance) VALUES ('" . $mygroup . "', '" . $mymodel . "', '" . mysql_real_escape_string($_POST['partname']) . "', '" . mysql_real_escape_string($_POST['cost']) . "', '" . $balance . "')";echo $sql;// $nresult = mysql_query($nsql) or die("Error 2: query: $nsql<br>" . mysql_error());[/code]Ray Link to comment https://forums.phpfreaks.com/topic/29138-me-and-this-syntax-issue/#findComment-133626 Share on other sites More sharing options...
dlyles Posted December 5, 2006 Author Share Posted December 5, 2006 Thanks. Link to comment https://forums.phpfreaks.com/topic/29138-me-and-this-syntax-issue/#findComment-135493 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.