473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

error when posting to mysql w/ php

If someone can help me out with this i would really appreciate it. I'm kind of new so don't bash my code too bad!!

This is the error:
Parse error: parse error, unexpected T_VARIABLE in /srv/www/htdocs/sendinfo.php on line 45

This is the code:
<?php
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$address=$_POST['address'];
$address2=$_POST['address2'];
$address3=$_POST['address3'];
$citye=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$subject="Data Added";
$f*******@YYY.com;
$ipaddress = $_SERVER['REMOTE_ADDR'];

mail("XX*@XXX.com",$subject, "Street Address: $address\r\nCity:$city\r\nZip: $zip\r\nIP: $ipaddress", "FROM: $from\r\n");
echo "Your IP address is: $ipaddress";
?>

<?php
$username="XXX";
$password="XXXX";
$database="XXXX";
$localhost="localhost";
$fname= mysql_escape_string($_POST['fname']);
$lname= mysql_escape_string($_POST['lname']);
$address= mysql_escape_string($_POST['address']);
$address2= mysql_escape_string($_POST['address2']);
$address3= mysql_escape_string($_POST['address3']);
$city= mysql_escape_string($_POST['city']);
$state= mysql_escape_string($_POST['state']);
$zip= mysql_escape_string($_POST['zip']);
$phone= mysql_escape_string($_POST['phone']);
$email= mysql_escape_string($_POST['email']);
$ipaddress=mysql_escape_string($_SERVER['REMOTE_ADDR']
$conn=mysql_connect($localhost, $username, $password) or die("Unable to setup connection"); //This is the line the error is referencing
mysql_select_db($database,$conn) or die( "Unable to select database");
$query = "INSERT INTO leads VALUES('$fname','$lname','$address','$address2','$ address3','$city','$state','$zip','$phone','$email ',$ipaddress)";
echo $query;
mysql_query($query) or die("Error: ".mysql_error());
mysql_close();
?>
Jul 19 '05 #1
17 2210
I got it, Thanks!!
"SuSe newbie" <jk******@sc.rr.com> wrote in message news:Tp*********************@twister.southeast.rr. com...
If someone can help me out with this i would really appreciate it. I'm kind of new so don't bash my code too bad!!

This is the error:
Parse error: parse error, unexpected T_VARIABLE in /srv/www/htdocs/sendinfo.php on line 45

This is the code:
<?php
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$address=$_POST['address'];
$address2=$_POST['address2'];
$address3=$_POST['address3'];
$citye=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$subject="Data Added";
$f*******@YYY.com;
$ipaddress = $_SERVER['REMOTE_ADDR'];

mail("XX*@XXX.com",$subject, "Street Address: $address\r\nCity:$city\r\nZip: $zip\r\nIP: $ipaddress", "FROM: $from\r\n");
echo "Your IP address is: $ipaddress";
?>

<?php
$username="XXX";
$password="XXXX";
$database="XXXX";
$localhost="localhost";
$fname= mysql_escape_string($_POST['fname']);
$lname= mysql_escape_string($_POST['lname']);
$address= mysql_escape_string($_POST['address']);
$address2= mysql_escape_string($_POST['address2']);
$address3= mysql_escape_string($_POST['address3']);
$city= mysql_escape_string($_POST['city']);
$state= mysql_escape_string($_POST['state']);
$zip= mysql_escape_string($_POST['zip']);
$phone= mysql_escape_string($_POST['phone']);
$email= mysql_escape_string($_POST['email']);
$ipaddress=mysql_escape_string($_SERVER['REMOTE_ADDR']
$conn=mysql_connect($localhost, $username, $password) or die("Unable to setup connection"); //This is the line the error is referencing
mysql_select_db($database,$conn) or die( "Unable to select database");
$query = "INSERT INTO leads VALUES('$fname','$lname','$address','$address2','$ address3','$city','$state','$zip','$phone','$email ',$ipaddress)";
echo $query;
mysql_query($query) or die("Error: ".mysql_error());
mysql_close();
?>
Jul 19 '05 #2
SuSe newbie wrote:
If someone can help me out with this i would really appreciate it. I'm
kind of new so don't bash my code too bad!!

<code snip>

Missing semicolon on line above one with the error

~Cameron
Jul 19 '05 #3
I got it, Thanks!!
"SuSe newbie" <jk******@sc.rr.com> wrote in message news:Tp*********************@twister.southeast.rr. com...
If someone can help me out with this i would really appreciate it. I'm kind of new so don't bash my code too bad!!

This is the error:
Parse error: parse error, unexpected T_VARIABLE in /srv/www/htdocs/sendinfo.php on line 45

This is the code:
<?php
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$address=$_POST['address'];
$address2=$_POST['address2'];
$address3=$_POST['address3'];
$citye=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$subject="Data Added";
$f*******@YYY.com;
$ipaddress = $_SERVER['REMOTE_ADDR'];

mail("XX*@XXX.com",$subject, "Street Address: $address\r\nCity:$city\r\nZip: $zip\r\nIP: $ipaddress", "FROM: $from\r\n");
echo "Your IP address is: $ipaddress";
?>

<?php
$username="XXX";
$password="XXXX";
$database="XXXX";
$localhost="localhost";
$fname= mysql_escape_string($_POST['fname']);
$lname= mysql_escape_string($_POST['lname']);
$address= mysql_escape_string($_POST['address']);
$address2= mysql_escape_string($_POST['address2']);
$address3= mysql_escape_string($_POST['address3']);
$city= mysql_escape_string($_POST['city']);
$state= mysql_escape_string($_POST['state']);
$zip= mysql_escape_string($_POST['zip']);
$phone= mysql_escape_string($_POST['phone']);
$email= mysql_escape_string($_POST['email']);
$ipaddress=mysql_escape_string($_SERVER['REMOTE_ADDR']
$conn=mysql_connect($localhost, $username, $password) or die("Unable to setup connection"); //This is the line the error is referencing
mysql_select_db($database,$conn) or die( "Unable to select database");
$query = "INSERT INTO leads VALUES('$fname','$lname','$address','$address2','$ address3','$city','$state','$zip','$phone','$email ',$ipaddress)";
echo $query;
mysql_query($query) or die("Error: ".mysql_error());
mysql_close();
?>
Jul 19 '05 #4
thanks Cameron,
now i'm getting an error on that line for
Parse error: parse error, unexpected ';' in /srv/www/htdocs/sendinfo.php on
line 43
any ideas??
"Cameron" <fo*@bar.invalid> wrote in message
news:bv**********@news5.svr.pol.co.uk...
SuSe newbie wrote:
If someone can help me out with this i would really appreciate it. I'm
kind of new so don't bash my code too bad!!

<code snip>

Missing semicolon on line above one with the error

~Cameron

Jul 19 '05 #5
SuSe newbie wrote:
thanks Cameron,
now i'm getting an error on that line for
Parse error: parse error, unexpected ';' in /srv/www/htdocs/sendinfo.php on
line 43
any ideas??
"Cameron" <fo*@bar.invalid> wrote in message
news:bv**********@news5.svr.pol.co.uk...
SuSe newbie wrote:
If someone can help me out with this i would really appreciate it. I'm
kind of new so don't bash my code too bad!!


<code snip>

Missing semicolon on line above one with the error

~Cameron



ah yes sorry, on the same line that had the missing semicolon there is
also a missing ) so it should end with );
Jul 19 '05 #6
Missing closing parentheses on that line.

--
Chris Dingman
Webmaster
Cabaret Theatre
http://www.cabarettheatre.org

Now selling officially licensed Cabaret Theatre merchandise
"SuSe newbie" <jk******@sc.rr.com> wrote in message
news:rz*********************@twister.southeast.rr. com...
thanks Cameron,
now i'm getting an error on that line for
Parse error: parse error, unexpected ';' in /srv/www/htdocs/sendinfo.php on line 43
any ideas??
"Cameron" <fo*@bar.invalid> wrote in message
news:bv**********@news5.svr.pol.co.uk...
SuSe newbie wrote:
If someone can help me out with this i would really appreciate it. I'm kind of new so don't bash my code too bad!!

<code snip>

Missing semicolon on line above one with the error

~Cameron


Jul 19 '05 #7
Thanks guys, i've gotten rid of those bugs now. I figured it was something
stupid. I hope this is the last time i'll ask, but i'm getting a new error
now. Check this out and let me know what you think:
Your IP address is: XX.XX.XX.XX INSERT INTO leads
VALUES('test','test','test','test','test','test',' sc','55555','5555555555','
an**@anon.com',XX.XX.XX.XX)Error: You have an error in your SQL syntax near
'.148.78)' at line 1
"Chris Dingman" <di****@cabarettheatre.org> wrote in message
news:rD******************@nwrdny03.gnilink.net...
Missing closing parentheses on that line.

--
Chris Dingman
Webmaster
Cabaret Theatre
http://www.cabarettheatre.org

Now selling officially licensed Cabaret Theatre merchandise
"SuSe newbie" <jk******@sc.rr.com> wrote in message
news:rz*********************@twister.southeast.rr. com...
thanks Cameron,
now i'm getting an error on that line for
Parse error: parse error, unexpected ';' in /srv/www/htdocs/sendinfo.php

on
line 43
any ideas??
"Cameron" <fo*@bar.invalid> wrote in message
news:bv**********@news5.svr.pol.co.uk...
SuSe newbie wrote:
> If someone can help me out with this i would really appreciate it. I'm > kind of new so don't bash my code too bad!!
>
<code snip>

Missing semicolon on line above one with the error

~Cameron



Jul 19 '05 #8
I got it, Thanks!!
"SuSe newbie" <jk******@sc.rr.com> wrote in message news:Tp*********************@twister.southeast.rr. com...
If someone can help me out with this i would really appreciate it. I'm kind of new so don't bash my code too bad!!

This is the error:
Parse error: parse error, unexpected T_VARIABLE in /srv/www/htdocs/sendinfo.php on line 45

This is the code:
<?php
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$address=$_POST['address'];
$address2=$_POST['address2'];
$address3=$_POST['address3'];
$citye=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$subject="Data Added";
$f*******@YYY.com;
$ipaddress = $_SERVER['REMOTE_ADDR'];

mail("XX*@XXX.com",$subject, "Street Address: $address\r\nCity:$city\r\nZip: $zip\r\nIP: $ipaddress", "FROM: $from\r\n");
echo "Your IP address is: $ipaddress";
?>

<?php
$username="XXX";
$password="XXXX";
$database="XXXX";
$localhost="localhost";
$fname= mysql_escape_string($_POST['fname']);
$lname= mysql_escape_string($_POST['lname']);
$address= mysql_escape_string($_POST['address']);
$address2= mysql_escape_string($_POST['address2']);
$address3= mysql_escape_string($_POST['address3']);
$city= mysql_escape_string($_POST['city']);
$state= mysql_escape_string($_POST['state']);
$zip= mysql_escape_string($_POST['zip']);
$phone= mysql_escape_string($_POST['phone']);
$email= mysql_escape_string($_POST['email']);
$ipaddress=mysql_escape_string($_SERVER['REMOTE_ADDR']
$conn=mysql_connect($localhost, $username, $password) or die("Unable to setup connection"); //This is the line the error is referencing
mysql_select_db($database,$conn) or die( "Unable to select database");
$query = "INSERT INTO leads VALUES('$fname','$lname','$address','$address2','$ address3','$city','$state','$zip','$phone','$email ',$ipaddress)";
echo $query;
mysql_query($query) or die("Error: ".mysql_error());
mysql_close();
?>
Jul 19 '05 #9

$citye=$_POST['city'];

I dont know if you have noticed but the varible here has an e on the end of
city but everywhere else it does not
Jul 19 '05 #10

$citye=$_POST['city'];

I dont know if you have noticed but the varible here has an e on the end of
city but everywhere else it does not
Jul 19 '05 #11

$citye=$_POST['city'];

I dont know if you have noticed but the varible here has an e on the end of
city but everywhere else it does not
Jul 19 '05 #12
SuSe newbie wrote:
Thanks guys, i've gotten rid of those bugs now. I figured it was
something stupid. I hope this is the last time i'll ask, but i'm
getting a new error now. Check this out and let me know what you
think: Your IP address is: XX.XX.XX.XX INSERT INTO leads
VALUES('test','test','test','test','test','test',' sc','55555','5555555555','
an**@anon.com',XX.XX.XX.XX)Error: You have an error in your SQL syntax
near
'.148.78)' at line 1


Everything in the values section is quoted (surrounded by single quotes)
except the IP address.
--
I won't rise to the occaasion, but I'll slide over to it.
Jul 19 '05 #13
SuSe newbie wrote:
Thanks guys, i've gotten rid of those bugs now. I figured it was
something stupid. I hope this is the last time i'll ask, but i'm
getting a new error now. Check this out and let me know what you
think: Your IP address is: XX.XX.XX.XX INSERT INTO leads
VALUES('test','test','test','test','test','test',' sc','55555','5555555555','
an**@anon.com',XX.XX.XX.XX)Error: You have an error in your SQL syntax
near
'.148.78)' at line 1


Everything in the values section is quoted (surrounded by single quotes)
except the IP address.
--
I won't rise to the occaasion, but I'll slide over to it.
Jul 19 '05 #14
SuSe newbie wrote:
Thanks guys, i've gotten rid of those bugs now. I figured it was
something stupid. I hope this is the last time i'll ask, but i'm
getting a new error now. Check this out and let me know what you
think: Your IP address is: XX.XX.XX.XX INSERT INTO leads
VALUES('test','test','test','test','test','test',' sc','55555','5555555555','
an**@anon.com',XX.XX.XX.XX)Error: You have an error in your SQL syntax
near
'.148.78)' at line 1


Everything in the values section is quoted (surrounded by single quotes)
except the IP address.
--
I won't rise to the occaasion, but I'll slide over to it.
Jul 19 '05 #15
On Tue, 27 Jan 2004 05:21:27 +0000, SuSe newbie wrote:
thanks Cameron,
now i'm getting an error on that line for Parse error: parse error,
unexpected ';' in /srv/www/htdocs/sendinfo.php on line 43
any ideas??

<snip!>
Parse Error *always* means "syntax error". Meaning that you have a missing
semicolon, curly brace, unclosed double-quote, extra parentheses, etc.

Basically, a typo. Syntax errors can be very hard to find.

--
-------------------------
| Jeffrey Silverman |
| jeffrey-AT-jhu-DOT-edu|
-------------------------

Jul 19 '05 #16
On Tue, 27 Jan 2004 05:21:27 +0000, SuSe newbie wrote:
thanks Cameron,
now i'm getting an error on that line for Parse error: parse error,
unexpected ';' in /srv/www/htdocs/sendinfo.php on line 43
any ideas??

<snip!>
Parse Error *always* means "syntax error". Meaning that you have a missing
semicolon, curly brace, unclosed double-quote, extra parentheses, etc.

Basically, a typo. Syntax errors can be very hard to find.

--
-------------------------
| Jeffrey Silverman |
| jeffrey-AT-jhu-DOT-edu|
-------------------------

Jul 19 '05 #17
On Tue, 27 Jan 2004 05:21:27 +0000, SuSe newbie wrote:
thanks Cameron,
now i'm getting an error on that line for Parse error: parse error,
unexpected ';' in /srv/www/htdocs/sendinfo.php on line 43
any ideas??

<snip!>
Parse Error *always* means "syntax error". Meaning that you have a missing
semicolon, curly brace, unclosed double-quote, extra parentheses, etc.

Basically, a typo. Syntax errors can be very hard to find.

--
-------------------------
| Jeffrey Silverman |
| jeffrey-AT-jhu-DOT-edu|
-------------------------

Jul 19 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: SuSe newbie | last post by:
If someone can help me out with this i would really appreciate it. I'm kind of new so don't bash my code too bad!! This is the error: Parse error: parse error, unexpected T_VARIABLE in...
1
by: Danny | last post by:
I am posting xml to a server and get the above error returned. The client code is listed below, it works until say a "<" character is put in XmlData. On the server page I try to pick up the XmlData...
9
by: phopman | last post by:
Hello! I am currently working on a project. And have been assigned to get up to speed quickly on php. And even though I love the language, it's not easy to get up to speed in like 2 seconds :-) ...
1
by: srinivasMP51 | last post by:
<?php $host = “localhost”; //Host where this database is running. $user_name = “root”; //Your MySQL Server’s user name $password = “yyyyyyy”; //Your MySQL Server’s Password $db_name...
2
by: neogazz | last post by:
Please see the attached picture. When I try to create my MySQL table using the below commands I get the attached error, why? mysql> CREATE TABLE grocery_inventory ( -> id int not null primary key...
1
by: Victor Miagkikh | last post by:
I'm getting a foreign key constraint error when I use MySQL running under Windows 7. When I run the same MySQL and Hybernate code on Mac it works just fine. Here are the details of the error: ...
2
by: ben pymer | last post by:
Hi All I am currently in the process of migrating several sites from one web server running IIS to another. Everything is fine apart from a couple of the pages in certain sites which reference...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.