473,396 Members | 2,020 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,396 software developers and data experts.

Php Parse Error

Leen
22
Hello, please if u can help me, I am working on project developing a website.
I write the sign up page but the server gives me a parse error. please notify what it is?
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <?php
  3. $fname=$_POST["nom"];
  4. $lname=$_POST["prenom"];
  5. $pname=$_POST["perenom"];
  6. $ddn=$_POST["dob"];
  7. $tel=$_POST["phone"];
  8. $ema=$_POST["mail"];
  9. $vil=$_POST["ville"];
  10. $ru=$_POST["rue"];
  11. $imm=$_POST["immeuble"];
  12. $idc=$_POST["idcard"];
  13. $pofs=$_POST["pps"];
  14. $uname=$_POST["userNom"];
  15. $pwd=$_POST["pass"];
  16. include("MySQLConnection.php");
  17. $insert="INSRET INTO etudiante values(", "$fname", "$lname", "$pname", "$ddn", "$tel", "$ema", "$vil", "$ru",
  18.  "$imm", "$idc", "$pofs","$uname", MD5('$pwd'))";
  19.  $result= mysql_query($insert);
  20.  if($result)
  21.  {
  22.      header("Location:Acceptance.php");
  23.  }
  24.  else
  25.  {
  26.      echo("You have missing or wrong input infomation". mysql_error());
  27.  }
  28.  mysql_close();
  29.  ?>
thanks for your help
Aug 14 '10 #1
5 1345
zorgi
431 Expert 256MB
Hi there

Your error is probably coming from this line:

Expand|Select|Wrap|Line Numbers
  1. $insert="INSRET INTO etudiante values .....
  2.  
But I think the best place for you to start would be this tutorial:

http://bytes.com/topic/mysql/insight...basic-tutorial
Aug 14 '10 #2
Leen
22
i know the error in this line but what is it? and why??
Aug 14 '10 #3
zorgi
431 Expert 256MB
From php Manual:

resource mysql_query ( string $query [, resource $link_identifier ] )

As you can see it needs parameter $query of type string. Your variable $insert is not well defined string so apart from above mentioned tutorial you need to understand strings in php and quotes within the string. I googled a bit and found this tutorial that looks simple enough:

http://www.php-learn-it.com/php_strings.html

Study this few links I gave you. Once you understand them you will be able to fix your code. After that you should look into validating user input and properly escaping special characters in a string for use in an SQL statement.
Aug 14 '10 #4
Tasim
2
Hi
Please check you query. There is an inverted comma mis use problem. Use the following query:


$INSERT = "INSRET INTO etudiante values('', '$fname', '$lname', '$pname', '$ddn', '$tel', '$ema', '$vil', '$ru', '$imm', '$idc', '$pofs', '$uname', 'MD5($pwd)')";

I will definitely works.
Aug 15 '10 #5
johny10151981
1,059 1GB
Even though the answer is given, I want to suggest a little to developer...

you have used 12 post value
Expand|Select|Wrap|Line Numbers
  1.  
  2.  $fname=$_POST["nom"];
  3.  $lname=$_POST["prenom"];
  4.  ...
  5.  ...
  6.  
The fact that is interesting is you have used in every case post data name and php variable name is different. Of course nothing wrong with that.

but if you use same name in the both field that is very helpful

Expand|Select|Wrap|Line Numbers
  1.  
  2.  $fname=$_POST["fname"];
  3.  $prenom=$_POST["prenom"];
  4.  ...
  5.  ...
  6.  
I have seen when number of data increase(in your case 12) its become difficult to handle all data specially when you would discover that you have misused a varisble.
Aug 16 '10 #6

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
24
by: Andy Sutorius | last post by:
Has anyone successfully created a Hello World program without using Visual Studio.NET? If so, what IDE did you use and what namespaces did you import? Thanks! Andy Sutorius
2
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
5
by: Daniel Crespo | last post by:
Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"? Thanks
10
by: fei.liu | last post by:
Consider the following sample code char * ptr = "hello"; char carray = "hello"; int main(void){ } What does the standard have to say about the storage requirement about ptr and carray? Is...
4
by: arnuld | last post by:
i am learning C and doing the exercise 1-1 of K&R2, where K&R ask to remove some parts of programme and experiment with error, so here i go: #include <stdio.h> int main () { printf('hello...
1
by: James T. Dennis | last post by:
You'd think that using things like gettext would be easy. Superficially it seems well documented in the Library Reference(*). However, it can be surprisingly difficult to get the external details...
0
by: devito | last post by:
hi there, for some days i try to build the boost.python tutorial "hello world" without bjam on winxp by using mingw. so i wrote a *.bat-file like the following: // --- snip...
0
Nepomuk
by: Nepomuk | last post by:
Hi everybody! As was suggested here, today should be Hello World Day! So, here's my Hello World Program in bash script: #!/bin/bash i=0; function hello { case $i in 0) echo 'H' i=`expr...
0
by: tosreejithp | last post by:
Hi, My first problem was i am not able to compiled a file from java script to java class.Now its clear and working fine..now i can convert a java script file to java class by Rhino Java Script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...
0
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...
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,...

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.