Forums
This topic is locked
syntax error, unexpected T_ENCAPSED_AND_WHITESPACE
Posted 21 Feb 2008 15:55:41
1
has voted
21 Feb 2008 15:55:41 Nkosinathi Khoza posted:
Hi AllI have a syntax error on line 14
<?php
echo "connected";
// Get the data to be posted from the form send bulk sms blog form
//$emailAddress=$_POST['emailAddressTextField'];
$con = mysql_connect('somehost.com', 'someusername', 'somepassword');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Syscon0_SMSXchangeClients", $con);
echo " connection successful";
$sql="INSERT INTO emailSubscription(emailAddress,contactSource) VALUES('$_POST['emailAddressTextField']','sendbulksmssite')"; // This is the line with an error
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
Replies
Replied 22 Feb 2008 10:46:11
22 Feb 2008 10:46:11 Alan C replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
$sql="INSERT INTO emailSubscription(emailAddress,contactSource) VALUES('$_POST['emailAddressTextField']','sendbulksmssite')"; // This
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
the bit that reads
<pre id=code><font face=courier size=2 id=code> emailSubscription(emailAddress,contactSource)</font id=code></pre id=code>
looks suspect to me, it looks like a functions call to emailSubscription, but the arguments are shown as text, higher up you have emailAddress being assigned a value, so you would need a $ at the front of it and probably the same for contactSource
at that point $emailAddress would have no value because the line above is commented out
Hope I've interpreted that right, if not, I'm sure someone else will pick up on it <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
$sql="INSERT INTO emailSubscription(emailAddress,contactSource) VALUES('$_POST['emailAddressTextField']','sendbulksmssite')"; // This
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
the bit that reads
<pre id=code><font face=courier size=2 id=code> emailSubscription(emailAddress,contactSource)</font id=code></pre id=code>
looks suspect to me, it looks like a functions call to emailSubscription, but the arguments are shown as text, higher up you have emailAddress being assigned a value, so you would need a $ at the front of it and probably the same for contactSource
at that point $emailAddress would have no value because the line above is commented out
Hope I've interpreted that right, if not, I'm sure someone else will pick up on it <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 22 Feb 2008 14:03:12
22 Feb 2008 14:03:12 Nkosinathi Khoza replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
$sql="INSERT INTO emailSubscription(emailAddress,contactSource) VALUES('$_POST['emailAddressTextField']','sendbulksmssite')"; // This
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
the bit that reads
<pre id=code><font face=courier size=2 id=code> emailSubscription(emailAddress,contactSource)</font id=code></pre id=code>
looks suspect to me, it looks like a functions call to emailSubscription, but the arguments are shown as text, higher up you have emailAddress being assigned a value, so you would need a $ at the front of it and probably the same for contactSource
at that point $emailAddress would have no value because the line above is commented out
Hope I've interpreted that right, if not, I'm sure someone else will pick up on it <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Thanks that was the problem
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
$sql="INSERT INTO emailSubscription(emailAddress,contactSource) VALUES('$_POST['emailAddressTextField']','sendbulksmssite')"; // This
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
the bit that reads
<pre id=code><font face=courier size=2 id=code> emailSubscription(emailAddress,contactSource)</font id=code></pre id=code>
looks suspect to me, it looks like a functions call to emailSubscription, but the arguments are shown as text, higher up you have emailAddress being assigned a value, so you would need a $ at the front of it and probably the same for contactSource
at that point $emailAddress would have no value because the line above is commented out
Hope I've interpreted that right, if not, I'm sure someone else will pick up on it <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Thanks that was the problem