homepage Welcome to WebmasterWorld Guest from 54.197.19.35
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Parse error</b>: parse error, unexpected T_CONSTANT_ENCAPSED_STRING i
Parse error</b>: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in <b>
Flolondon




msg:1282820
 5:49 pm on Apr 26, 2005 (gmt 0)

Someone please help me with this as i am getting the above errors.. in line 6 i..e mysql...
<html>
<?php
if ($submit)
{
$db = mysql_connect ("localhost", "root, "");
mysql_select_db ("learndb", $db);
$sql = INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first', '$last', '$nick', '$email', '$salary')
$result = mysql_query ($sql);
echo "Thank you! Information entered.\n";
}
else
{
?>
<form method="post" action="input.php">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Nick name:<input type="Text" nickname="first"><br>
E-mail:<input type="Text" name="email"><br>
Salary:<input type="Text" name="salary"><br>
input type="Submit" name="submit" value=" Enter information">
</form>

<?php

}

php?>
</HTML>

 

sned




msg:1282821
 6:02 pm on Apr 26, 2005 (gmt 0)

Don't know if this is a type or not but

$sql = INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first', '$last', '$nick', '$email', '$salary')

should be :

$sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first', '$last', '$nick', '$email', '$salary')";

-sned

Flolondon




msg:1282822
 6:08 pm on Apr 26, 2005 (gmt 0)

hiya. i have tried it but unfortunately it does not work...

jatar_k




msg:1282823
 6:51 pm on Apr 26, 2005 (gmt 0)

sned's correction is right but I think your error is above that

$db = mysql_connect ("localhost", "root, "");

you're missing a "

$db = mysql_connect ("localhost", "root", "");

Flolondon




msg:1282824
 6:56 pm on Apr 26, 2005 (gmt 0)

hiya..

i observed that and corrected it with a " and there is still an error apparently...

jatar_k




msg:1282825
 7:23 pm on Apr 26, 2005 (gmt 0)

php?>

should be

?>

Filipe




msg:1282826
 8:33 pm on Apr 26, 2005 (gmt 0)

It doesn't tell you which line the error is on?

ncreegan




msg:1282827
 8:46 pm on Apr 26, 2005 (gmt 0)

you're still missing a ; in line five, if you're still getting the same error. if that's not it post the new version of your script

ncreegan




msg:1282828
 8:50 pm on Apr 26, 2005 (gmt 0)

actually just try this

<html>
<?
if ($submit) {
$db = mysql_connect ("localhost", "username", "password");
mysql_select_db ("learndb", $db);
$sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first', '$last', '$nick', '$email', '$salary')";
$result = mysql_query($sql);
if (!$result) {
die('Query failed: ' . mysql_error());
} else {
echo "Thank you! Information entered.\n";
}
}
?>
<form method="post" action="input.php">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Nick name:<input type="Text" nickname="first"><br>
E-mail:<input type="Text" name="email"><br>
Salary:<input type="Text" name="salary"><br>
input type="Submit" name="submit" value="Enter information">
</form>
</html>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved