Hi forumz
I have this pdf book im reading and it has this codes that im reading. Its soo good coz im understunding but now im stuck abit there is a code like this which brings an error. (unexpected T_STRING in ...datain.
php on line 6)
- PHP: Select all
<HTML>
<?php
$db = mysql_connect("localhost", "root","");
mysql_select_db("learndb",$db);
$sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first','$last','$nickname','$$result = mysql_query($sql)";
echo "Thank you! Information entered.\n";
?>
</HTML>
and the combined form of this and the
html to post some data in a database is this which is also giving out an error (unexpected T_STRING in ...datain.
php on line 6)
- PHP: Select all
<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','$nickname','$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" name="nickname"><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>
Someone please help Im a learner in
php. Im using wamp and the database is working