Jump to content
MakeWebGames

Recommended Posts

Posted

I'm curious...is there a way to modify this so that's there only a random list of 4-5 players shown that are eligible for attack? That way, I can slap that code on various screens, sorta like a shoutbox kinda thing.

Posted

Hi,

This is ace! This is just what Ive been looking for.

Is there a way to make it so that it only shows people in the same city as you though? As obviouslly people not in the same city you can not attack.

streetsyndicate - I'm not a coder but on line 8, change to:

$users = $db->query ("SELECT u.`userid`, u.`username`, u.`level`, u.`hp`, u.`gang`, g.`gangname`, g.`gangPREF` FROM `users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` limit 5");

 

This will limit it to displaying 5 (as you can see on the end there is now limit 5, change this to limit 4 if you want it to display 4).

Thanks.

P.S. I test the above and it works.

Posted

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Try that untested though.

If it does work you can use $u['cityname'] for something if you like :)

Posted

Doesnt work :(

QUERY ERROR: You have an error in your SQL syntax; check the

manual that corresponds to your MySQL server version for the right

syntax to use near '.`cityname` FROM

`users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` L' at line 1

Query was SELECT u.`userid`, u.`username`, u.`level`, u.`hp`,

u.`gang`, u.`location`, g.`gangname`, g.`gangPREF` c.`cityname` FROM

`users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` LEFT JOIN

`cities` c ON c.`cityID` = 7

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.   Paste as plain text instead

  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...