Jump to content

Please..help me with my simple code ?


curt girl

Recommended Posts

Hello ..Im so glad to be here with u all

 

I am a novice in the use of this php/sql  and I  have to complete my project..but Unfortunately,  I got this  problem and I couldent figure out  where the mistake lies.. please any advice

 

here u my code

<html>
<body background="3d-background-blue.jpg">
<?php
$x1=$_POST['fname'];
$x2=$_POST['age'];
$x3=$_POST['password'];
$x4=$_POST['email'];
$x5=$_POST['yourtype'];
mysql_connect("localhost","root","")or
die("there is a problem ");
mysql_select_db("order1")or die("no DB");

// check if the username is taken
$check = "select id from users where fname = '$x1'";
$qry = mysql_query($check) or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry);
if ($num_rows != 0) {
echo "Sorry, there the username $x1 is already taken.
";
echo "Try again";
echo "<a href= iinterface.html >home</a>";
echo "<br>";
exit();
}
else {

// insert the data

$query="insert into users (fname,age,password,email,type) values('$x1','$x2','$x3','$x4','$x5')";
$result=mysql_query($query);
if($result){
echo "thanks for registering $x1 " ;echo "<br>";
echo "the date of registeration is ";
Echo gmdate ("D, d M Y H:i:s");
echo "<br>";
echo "<br>";
echo "<a href=iinterface.html > back to main </a>";
echo "<br>"; 
}
else
{echo"insertion error";
}
?>
</body>
</html> 

 

the massege of error is :

 

Parse error: parse error in  insert2.php  on line 45

 

 

Link to comment
https://forums.phpfreaks.com/topic/225615-pleasehelp-me-with-my-simple-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.