Jump to content

this thing is killing my database..


Monkuar

Recommended Posts

i have a mod that it put's a image next to a users name in the viewforum.php (im using punbb btw)

 

but nonethless this is simple php/mysql that fails me:

 

//If there's a last poster
$result4 = $db->query('SELECT imgaward FROM users WHERE username="'.($cur_topic['last_poster']).'" ') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

    
    $post_user = $db->fetch_assoc($result4);

             // Image Award Mod Block Start
            //figure out the size of the award (Name of award should be in teh form:  Test_Award_100x20.png ... where png is format, 100x20 is dimensions and Test_Award is name of award (seen in admin interface)
            $lol23=$post_user['imgaward'];

		if ($post_user['imgaward'] == "") { 
            $lol123 = "";
		}
		else {
		$lol123 = "<img src='img/stars/$lol23'>";
		}

 

So im selecting imgaward where username=lastpost.. bla bla.

 

That is not good tho, because then when i do that, I have like 20 topics in 1 forum and it just runs 20 freaking query's and checks every user and crap,  how is this possible so i can get information from the topics table or something so it doesnt have 100queries run each time u refresh your viewforum page, example:

 

 

biulc2.jpg

 

Isn't there a way I can run that query just once and put

 

my variable $lol123 next to the username so it works??

 

 

 

 

~~~~_~_~_~_~_~

 

Thanks, if u got msn mine is nick445617@Hotmail.com please add me or post yours.. i really need im offering ftp access and everything!! Thanks..1 XD

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.