...

View Full Version : mysql error



amcf1992
09-14-2011, 11:24 PM
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /path/public_html/account.php on line 21



<?php session_start(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Account Dashboard</title>
</head>
<body>
<?php
include('dbsettings.php');

$con = mysql_connect("$host","$user","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("$db", $con);

$result = mysql_query("SELECT * FROM $tbl_name" );

while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br />";
}

mysql_close($con);
?>
<a href="logout.php"> Log Out </a>
</body>
</html>

myfayt
09-14-2011, 11:51 PM
I am not seeing $tbl_name defined anywhere. That would be a problem


$result = mysql_query("SELECT * FROM $tbl_name");

Also are you going to use WHERE in the query? I always prefer it.

amcf1992
09-14-2011, 11:58 PM
Okay it works like a charm, but since i md5 everything when user registers, when i retrieve it from the database, how do I un-md5 it so when the user looks at it, it doesn't appear as gibberish?

Fou-Lu
09-15-2011, 12:22 AM
See the other thread you have opened regarding this.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum