Problem with mysql...

Posted on Monday 21st May 2007 at 11:31 PM
Diablosblizz
Diablosblizz's Avatar
Code
$user1 = mysql_query("SELECT * FROM ibf_members ORDER BY posts DESC LIMIT 0,1") or die (mysql_error());
$fetchuser1 = mysql_fetch_assoc($user1);
$admin1 = $fetchuser1['username'];


I don't know whats wrong with this code, it was working with my other forum software, but when I changed it nothing happens.

That code should display Diablosblizz because I am the top poster, but it doesn't. It's just blank.

:( - Please help
Posted on Tuesday 22nd May 2007 at 12:28 AM
ShadowMage
ShadowMage's Avatar
after that do you have an echo? if not thats why o.o;

Code
$user1 = mysql_query("SELECT * FROM ibf_members ORDER BY posts DESC LIMIT 0,1") or die (mysql_error());
$fetchuser1 = mysql_fetch_assoc($user1);
$admin1 = $fetchuser1['username'];
echo "$admin1";
failure i sense
Posted on Tuesday 22nd May 2007 at 07:41 PM
Diablosblizz
Diablosblizz's Avatar
I do have the echo, and it doesn't show anything.
Posted on Tuesday 22nd May 2007 at 08:52 PM
SkillMaster
SkillMaster's Avatar
[code]

$user1 = mysql_query("SELECT * FROM ibf_members ORDER BY posts DESC LIMIT 0,1") or die (mysql_error());
$fetchuser1 = mysql_fetch_array($user1);
$admin1 = $fetchuser1['username'];
echo "$admin1";
[code]

Try that?
Posted on Wednesday 23rd May 2007 at 04:39 AM
gbt91
gbt91's Avatar
PHP Code
  1. $user = mysql_query("SELECT * FROM ibf_members ORDER BY posts DESC LIMIT 0,1") or die (mysql_error());
  2. $fetchuser = mysql_fetch_array($user);
  3. echo "$fetchuser['username']";

Try this lol
it's almost the same but i don't think you've to define $admin just use $fetchuser1['username']
That's Just The Drill
Posted on Wednesday 23rd May 2007 at 07:39 PM
Diablosblizz
Diablosblizz's Avatar
Both SkillMaster's and Gbt91 does not work:

For Gbt91 I get this
Code
Array


For SkillMaster's I get nothing but blankness.
Posted on Wednesday 23rd May 2007 at 07:53 PM
SkillMaster
SkillMaster's Avatar
[php]
$fetch = mysql_query("SELECT * FROM ibf_members ORDER BY posts DESC");
$member = mysql_fetch_array($fetch);
echo ("$member[username]");
[php]

Try again
Posted on Wednesday 23rd May 2007 at 07:56 PM
SkillMaster
SkillMaster's Avatar
Sorry This code
Code
$fetch = mysql_query("SELECT * FROM `ibf_members` ORDER BY `posts` DESC LIMIT 0, 1");
$member = mysql_fetch_array($fetch);
echo ("$member[username]");
Posted on Thursday 24th May 2007 at 07:08 PM
Diablosblizz
Diablosblizz's Avatar
Doesn't work.
Posted on Thursday 24th May 2007 at 09:24 PM
Diablosblizz
Diablosblizz's Avatar
EDIT: Fixed had to change username to user. Thanks Skilled.
Topic is locked