This is the part which searches and add the result to the 'pass' variable. At one stage I was getting a resource id number and found to get around that, but when I do this I get nothing on the pass variable

$result = mysql_query("SELECT `Pass` FROM `wiki` WHERE `User` ='" . $user ."'");
if ($result) {
$row = mysql_fetch_assoc($result);
$pass = $row['Pass'];
mysql_free_result($result);
}
mysql_close($con);

Can anyone help me please?
Thanks

This is the part which searches and add the result to the 'pass' variable. At one stage I was getting a resource id number and found to get around that, but when I do this I get nothing on the pass variable

$result = mysql_query("SELECT `Pass` FROM `wiki` WHERE `User` ='" . $user ."'");
if ($result) {
$row = mysql_fetch_assoc($result);
$pass = $row['Pass'];
mysql_free_result($result);
}
mysql_close($con);

Can anyone help me please?
Thanks

:) hey there lulemurfan!

i hope this helps :

//$result = mysql_query("SELECT Pass FROM wikiWHERE `User` ='" . $user ."'"); // maybe it's from here

$result = mysql_query("SELECT Pass FROM wiki WHERE User like '$user'"); // try this instead

if ($result) {
$row = mysql_fetch_assoc($result);
$pass = $row['Pass'];
mysql_free_result($result);
}
mysql_close($con);

you may also try to check first the query if it's getting the right value by echoing it first:
echo "your query : ".$result;

happy day ahead! ~_^

To add to ﻼim's answer you might want to also add on a die() or error reporting system for the query:

$result = mysql_query("SELECT Pass FROM wiki WHERE User like '$user'") or die(mysql_error());

That way if it does error, it'll stop loading the page and display what error happened so you know where to look or what actually happened. Note though that this will only fire if the error occurs inside the query itself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.