/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] says column is empty, but is not

I have the following

[code=php]$aomcheck = “SELECT accesslvl FROM users WHERE username=’$username'”;
$aomcheckresult = mysql_query($aomcheck);
echo “Access Level: “.$aomcheckresult;[/code]

, and I have already connected and everything to the sql db. Anyways when I run this it returns the result Access Level: Resource id #3 which I learned recently that that meant that the table was empty, but it is not. $username is set correctly, all table names and everything is correct. I have personally checked more than once, to insure that the information is in fact there, but it continues to echo out that, any help here? Thanks.

[b]EDIT[/b]: I also tried to use

[code=php]$aomcheckresult = mysql_query(“SELECT accesslvl FROM users WHERE username=’$username'”);
$aomrow = mysql_fetch_array($aomcheckresult);[/code]

and then echoing out

[code=php]echo $aomrow[‘aomcheckresult’];[/code]

but that did not work either. The reason I tried this was because it worked for me recently in a very similar thing(last visit). Anyways, is there something wrong with that code or what. Again, Thanks.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@bokehJul 05.2006 — The manual does a good job of answering questions such as this.[code=php]$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result))
{
$row = mysql_fetch_assoc($result);
# do something with it
}
else
{
# no result
}[/code]
Copy linkTweet thisAlerts:
@Heavy_MetalauthorJul 06.2006 — Thanks, But I just figured out how to do it using mysql_fetch_array. I was calling $aomrow['variable name']; and I needed to be calling $aomrow['accesslvl']; I was looking at it and it just poped at out me., Anyways thanks for the time and effort.
×

Success!

Help @Heavy_Metal spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...