Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

wanting to inset into my db, and I get this message.

Codes here !

Moderators: macek, egami, gesf

wanting to inset into my db, and I get this message.

Postby jesman » Sun May 27, 2012 12:17 pm

Parse error: syntax error, unexpected T_VARIABLE in /home/teeshome/public_html/freeestimate.php on line 4, code below. Thanks for your help.

<?
if (isset($_POST['something'])
//create short varible names
$Firstname=$_POST[Firstname];
$State=$_POST[State];
$Streetnumber=$_POST[$Streetnumber];
$zipcode=$_POST[zipcode];
if (!$Firstname || !$State || !$Streetnumber || !$zipcode);{
echo "You have not entered all the required details.<br/>"
."Please go back and try again.";
exit;
}
if (!get_magicquotes_gpc()) {
$Firstname=addslashes($Firstname);
$State=addslashes($State);
$Streetnumber=addslashes($Streetnumber);
$zipcode=addslashes($zipcode);
}

@ $db = new mysqli ('localhost','teeshome','godman777','freeestimates')
// if (mysqli_connect_errno()){
// echo "Error: Could not connect to database. Please try again later.";
// exit;
//}
$Query="insert into freeestimates values
('".$Firstname."','".$State."','".$Steetnumber."','".$zipcode."')";
$result= $db->query ($query);

if ($result){
echo $db->affected_rows."freeestimates inserted into database.";

} else {
echo"An error has occured. The item was not added.";

}
$db->close();
?>
jesman
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed May 23, 2012 8:44 pm

Return to mySQL & php coding

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron