0

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

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Nyight
0

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! ~_^

Edited by ﻼim: additional. Ϋ

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.