473,657 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

35 New Member
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 1942
Luuk
1,047 Recognized Expert Top Contributor
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
ehpratah
35 New Member
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 Recognized Expert Top Contributor
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
2094
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 and from the CommandText string below, but when I run it as is I get the error SQL Serv Syntax Error or Access Violation on the "Execute" line. _ContactFetchLike 'Thom%' also works when I run it from the Query Analyser.
3
2489
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 System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174 System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
5
4499
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 including the -q64 option in xlC compiler. And we are able to link all these libraries to one of the main applications and generate an executable. SKLoader. But, when we try to run this main executable, we are getting the following errors:
2
4802
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 sql server is my backend server. This error occured whenever i step through and when it reaches rs.update it jux hangs down there and thereafter it shwn the aforementioned error. I am using the RecordSet properties to add the values. Can I use...
2
3502
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
5838
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
10183
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
1980
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 on the error displayed in firebug,it redirects to a js file line 186 >>
68
11137
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 my code: <?php //Connect To Database $hostname='mideasthonors2.db.4381361.hostedresource.com'; $username='**************'; $password='***********'; $dbname='mideasthonors2';
2
6187
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 at heading)after clicking on SAVE button and Highlighting the statement which are as follows..... rs.Open "Insert into addclasses (Batch, BatchTime, Std, CollYear, SchlBtchName, CollBtchName, BatchType, SchlSubjct ,CollSubjct, Teacher, Days,...
0
8312
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7337
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.