Reputation: 3
I want to get the data from my database. The page does not change when I upload the file. Where am I wrong?
verifycheck.php
<?php
$con=mysql_connect ("###", "###", "###");
mysql_select_db ("db_name", $con);
$result = mysql_query($con,"SELECT * FROM db_tablename");
echo "<table border='1'>
<tr>
<th>username</th>
<th>email</th>
<th>password</th>
<th>confirm_password</th>
</tr>";
while($row = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "<td>" . $row['confirm_password'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
Upvotes: 0
Views: 77
Reputation: 3558
Please Check with your connection parameters as localhost,username password, database and also changing the
$result = mysql_query($con,"SELECT * FROM db_tablename");
as
$result = mysql_query("SELECT * FROM db_tablename",$con);
Upvotes: 0
Reputation: 23978
Remove $con,
from the mysql_query
As mysql_query()
expects first parameter to be the SQL Query, not the SQL connection.
$result = mysql_query("SELECT * FROM db_tablename");
Upvotes: 0
Reputation: 23836
Connection object should be second parameter and query string should be first parameter.
Try this
$result = mysql_query("SELECT * FROM db_tablename",$con);
Instead of
$result = mysql_query($con,"SELECT * FROM db_tablename");
Mysql function is deprecated and will remove in future go for Mysqli or PDO for preventing sql injection
Upvotes: 1