2 Replies - 253 Views - Last Post: 19 March 2012 - 09:19 AM Rate Topic: -----

#1 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Right syntax

Posted 19 March 2012 - 09:12 AM

<?php
include("connect.php");
?>
<html>
<head>
<?php
	if(isset($_REQUEST['subie']))
	{
     $lname=$_POST['lname'];
	 $fname=$_POST['fname'];
	 $add=$_POST['add'];
	 $tel=$_POST['tel'];
	 $uname=$_POST['uname'];
	 $pass= md5($_POST['pass']);
	 
mysql_query("INSERT INTO users (lname,fname,add,tel,uname,pass)
VALUES ('$lname','$fname','$add','$tel','$uname','$pass')") or die(mysql_error());
	echo '<meta http-equiv="refresh" content="0;url=index.php">';
	 exit;
	}			
	 ?>

</head>
<body>

	 <div style=\"position:fixed;
				top:100px;
				left:50%;
				margin-left:-200px;
				width:400px;
				background:#FFFFFF;
				padding:10px 15px 10px 15px;
				border:10px solid #CCCCCC;
				 \">
	<form method="post" action="register.php">
	Last Name: <br/>
		<input type="text" name="lname" /><br />
		
	First Name: <br/>
		<input type="text" name="fname" /><br />
	
	Address: <br />
		<input type="text" name="add" /><br />
		
	Telephone Number: <br/>
		<input type="text" name="tel" /><br />
		
	Username: <br/>
		<input type="text" name="uname" /><br />
		
	Password: <br/>
		<input type="password" name="pass" /><br />
		
		<br />
	<input type="submit" name="subie" value="submit" />
	<a href="index.php"><input type="button" name="subie" value="back" /></a>
</form>
</div>
</body>
</html>



error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'add,tel,uname,pass) VALUES ('Que','Mark kenneth','Baguio City','179238','user1'' at line 1



Disregard the protection thing i'll gonna fix it soon after this error..

any help would be appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: Right syntax

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3525
  • View blog
  • Posts: 10,170
  • Joined: 08-June 10

Re: Right syntax

Posted 19 March 2012 - 09:15 AM

add is a reserved MySQL keyword.
Was This Post Helpful? 1
  • +
  • -

#3 Syfer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 190
  • Joined: 08-October 10

Re: Right syntax

Posted 19 March 2012 - 09:19 AM

View PostDormilich, on 19 March 2012 - 09:15 AM, said:



Thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1