473,385 Members | 1,676 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,385 software developers and data experts.

Saving data error: Parse error: syntax error, unexpected ')'

hi im having a problem in saving data in my database and i try everything i know but still im having this error message in my page..please help me thanks guys

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. /*$cs = mysql_connect ('localhost')or die ("not connect .". mysql_error());
  3. $ds = mysql_select_db ('dbase')or die ("no data .". mysql_error());
  4.  
  5. $host = 'localhost';
  6. $username = 'globaml6';
  7. $password = 'Gwd_2011';
  8.  
  9. $conn = mysql_connect($host, $username, $password) or die('Error connecting to mysql');
  10.  
  11. $dbname = 'globaml6_gwd';
  12. mysql_select_db($dbname);
  13. */
  14. $dbhost = 'localhost';
  15. $dbuser = 'root';
  16. $dbpass = '';
  17.  
  18. $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
  19.  
  20. $dbname = 'msic';
  21. mysql_select_db($dbname);
  22.  
  23.  
  24.  
  25.  
  26. $sql="INSERT INTO sd (Pickday, Pickmonth, Pickhour, Pickmin, Rday, Rmonth, Rhour, Rmin, Origin, Destination, Vehicle, Fname, Lname, Email, Contact, Address, Zip, City, Country) 
  27. VALUES ('".$_POST['txtpday']."', '".$_POST['txtpmonth']."', '".$_POST['txtphr']."', '".$_POST['txtpmin']."', '".$_POST['txtrday']."',  '".$_POST['txtrmonth']."',  '".$_POST['txtrhr']."',  '".$_POST['txtrmin']."', '".$_POST['txtorigin']."', '".$_POST['txtdestination']."',  '".$_POST['txtvehicle']."',  '".$_POST['txtfname']."', '".$_POST['txtlname']."',  '".$_POST['txtemail']."',  '".$_POST['txtcontact']."',  '".$_POST['txtadd']."', '".$_POST['txtzip']."',  '".$_POST['txtcity']."',  '".$_POST['txtcountry']);
  28.  
  29.  
  30.  
  31.  
  32. if (!mysql_query($sql,$conn))
  33.   {
  34.   die('Error: ' . mysql_error());
  35.   }
  36.     header("location:index.html");
  37.  
  38.  
  39. mysql_close($conn)
  40.  
  41.  
  42. /*
  43.     $result=mysql_query($sql);    
  44.     echo $sql;
  45.     echo $result;
  46. */
  47. ?>
  48.  
  49.  
this is the error

Parse error: syntax error, unexpected ')' in C:\xampp\htdocs\msicweb\sdsave.php on line 27
Mar 31 '12 #1
3 1934
Luuk
1,047 Expert 1GB
Look a the code below, and try to understand what it does,
After understanding the quotes, you will know how to change your code:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.         $nl="<br>".PHP_EOL;
  3.         print 'This will only print the letter t: t'.$nl;
  4.         print 'This will print the letter t followed by a single-quoot: t\''.$nl;
  5.         print "This will print a single-quoot: '".$nl;
  6.         print "This will print two single-quotes: ''".$nl;
  7.         print 'This will print one single-quote: \''.$nl;
  8.         print 'This should print two single-quotes: \'\''.$nl;
  9.         print 'This will print a double-quoot: "'.$nl;
  10.         print "This will also print a double-quoot: \"".$nl;
  11. ?>
  12.  
Mar 31 '12 #2
luuk can you help me pinpoint where is my error cause i already scan my code a couple of times but i still cant get it..
Mar 31 '12 #3
Luuk
1,047 Expert 1GB
the end of line 27:
Expand|Select|Wrap|Line Numbers
  1.  '".$_POST['txtcountry']);
change it to :
Expand|Select|Wrap|Line Numbers
  1.  '".$_POST['txtcountry'].")";
Mar 31 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Mike Thomas | last post by:
This one must be very simple. I am trying to run an SQL Serv 7.0 stored proc from a VBA module in an Access 2000 app. This stored proc runs fine when I remove the parameters from the stored proc...
3
by: Nathan Sokalski | last post by:
When trying to submit data to an Access database using ASP.NET I recieve the following error: System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
2
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and...
2
by: Shrutisinha | last post by:
I am getting this error in unix .. syntax error near unexpected token `(' when i am running my parser , can anybody help me plzz .. i am new to all this thanks
9
by: sudhanshu | last post by:
Hi friends, I am facing this error in my vb 6.0 code. The code is... Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command Private Sub cmdOK_Click()
4
by: nickyeng | last post by:
i calling this piece of java code in jsp : List<Customer> list = Customer.listby_page(currentRs); ... ... then it gives me the following error:
1
by: charith | last post by:
Hi All, I get this error very frequently syntax error () in frequently calling a servlets and html files also In the response of the makeRequest is this way "body":"","rc":"504" When clicked...
68
mideastgirl
by: mideastgirl | last post by:
I keep getting this error and I cannot figure it out. My curly brackets are closed, and I am using the correct tags for <?php to open and ?> to close my code. Can someone please help me! Here is...
2
by: rahul more | last post by:
Hiiii I am making my project in VB6.0 and my back end is Access 2003. I hav one problem..... When I going to save data into database, at at cmdSave_Click event, VB giving me error(Error mentioned...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.