mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htd

bakul

New Member
Messages
12
Reaction score
0
Points
0
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.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Re: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp

Code:
$result=mysql_query("SELECT*FORM form");

FROM, not FORM

Note that line 25 is

Code:
while($row=mysql_fetch_array($result))

The error message says you gave it a boolean value, ie $result is True or False.
Look above to see where $result is set. mysql_query() only returns a boolean on a SELECT request when there is an error.
 
Last edited:

bakul

New Member
Messages
12
Reaction score
0
Points
0
Re: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp

Please tell me why can't entry my new data of mysql table? Please help me.


Thanks a lot.
 

bakul

New Member
Messages
12
Reaction score
0
Points
0
Re: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp

Please tell me why can't entry my new data of mysql table? Please help me.


Thanks a lot.
 
Top