I have big problem data does not entry to db but send message:- Your record successfully added
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\signup\signup02.php on line 25
My php code is:-
<?php
if (isset($_POST['submit'])) {
$userName = $_POST["username"];
$fullName = $_POST["fullname"];
$email = $_POST["email"];
$password = $_POST["password"];
$con = mysql_connect("localhost", "root", "");
if (!$con) {
die('could not connect:' . mysql_error());
}
mysql_select_db("alhera", $con);
mysql_query("INSERT INTO form('user name', 'full name', 'e-mail', 'password') VALUES('$userName','$fullName','$email','$password')");
echo "Your record successfully added";
mysql_select_db("alhera", $con);
$result=mysql_query("SELECT*FORM form");
echo"<table border='1'>
<tr>
<th>user name</th>
<th>full name</th>
</tr>";
while($row=mysql_fetch_array($result))
{
echo"<tr>";
echo"<td>" .$row['user name']. "</td>";
echo"<td>" .$row['full name']. "</td>";
echo"</tr>";
}
echo"</table>";
mysql_close($con);
}
?>
Please help me to solve it.
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\signup\signup02.php on line 25
My php code is:-
<?php
if (isset($_POST['submit'])) {
$userName = $_POST["username"];
$fullName = $_POST["fullname"];
$email = $_POST["email"];
$password = $_POST["password"];
$con = mysql_connect("localhost", "root", "");
if (!$con) {
die('could not connect:' . mysql_error());
}
mysql_select_db("alhera", $con);
mysql_query("INSERT INTO form('user name', 'full name', 'e-mail', 'password') VALUES('$userName','$fullName','$email','$password')");
echo "Your record successfully added";
mysql_select_db("alhera", $con);
$result=mysql_query("SELECT*FORM form");
echo"<table border='1'>
<tr>
<th>user name</th>
<th>full name</th>
</tr>";
while($row=mysql_fetch_array($result))
{
echo"<tr>";
echo"<td>" .$row['user name']. "</td>";
echo"<td>" .$row['full name']. "</td>";
echo"</tr>";
}
echo"</table>";
mysql_close($con);
}
?>
Please help me to solve it.