Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 11-02-2006, 10:25 PM   #1
Baseband Member
 
hatedguilt's Avatar
 
Join Date: Feb 2006
Posts: 43
Send a message via AIM to hatedguilt Send a message via Yahoo to hatedguilt
Default php script, help

Error:
Parse error: syntax error, unexpected ',' in /home/hatedgui/public_html/solo/get.php on line 44

code:
<html>
<body>




<?php
$firstname = $_post['firstname'];
$lastname = $_post['lastname'];
$number = $_post['number'];
$email = $_post['email'];
$sex = $_post['sex'];
?>
<?
$nl = "<br />";
echo "Your name is: ";
echo $_POST['firstname'];
echo $nl;
echo "Your last name is: ";
echo $_POST['lastname'];
echo $nl;
echo "Your Phone # is: ";
echo $_POST['number'];
echo $nl;
echo "Your email is: ";
echo $_POST['email'];
echo $nl;
echo "You are a: ";
echo $_POST['sex'];
echo $nl;
?>

<?php
$username="****";
$password="****";
$database="hatedgui_solo";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
?>


<?php
$query = "INSERT INTO info VALUES
(",'$firstname','$lastname','$number','$email','$s ex')";
mysql_query($query);
?>



</body>
</html>
__________________

__________________
JustEatAtFatJoes
hatedguilt is offline   Reply With Quote
Old 11-03-2006, 06:29 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: php script, help

Quote:
Originally Posted by hatedguilt
Error:
Parse error: syntax error, unexpected ',' in /home/hatedgui/public_html/solo/get.php on line 44
on line 44 you have a double quote (") rather than two single quotes ('')
(I assume that this is an empty field, or an auto number?

anyway, here's the fixed code.

Code:
<html>
<body>




<?php
$firstname = $_post['firstname'];
$lastname = $_post['lastname'];
$number = $_post['number'];
$email = $_post['email'];
$sex = $_post['sex'];
?>
<?
$nl = "<br />";
echo "Your name is: ";
echo $_POST['firstname'];
echo $nl;
echo "Your last name is: ";
echo $_POST['lastname'];
echo $nl;
echo "Your Phone # is: ";
echo $_POST['number'];
echo $nl;
echo "Your email is: ";
echo $_POST['email'];
echo $nl;
echo "You are a: ";
echo $_POST['sex'];
echo $nl;
?>

<?php
$username="****";
$password="****";
$database="hatedgui_solo";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
?>


<?php
$query = "INSERT INTO info VALUES
('','$firstname','$lastname','$number','$email','$sex')";
mysql_query($query);
?>



</body>
</html>
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 09:57 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0