Arcade search games by champions name

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Arcade search games by champions name
pnclthnmstsh
CZ Active Member
pnclthnmstsh has been a member for over 19 year's 19 Year Member
usa.gif nevada.gif
Age: 53
Gender: Male
Website:
Status: Offline
Joined: Sep 17, 2004
0.04 posts per day
Posts: 267
Points: 13,641
   
Hello,
I'm working on a bit of code to allow members to search arcade games by the champions name and running into a bit of a snag. Here's the edits I've done to arcade_search.php:

Find:
if($searchin == 'name')
        {
        $where_search= "WHERE game_name LIKE '$search'";
        }
        elseif($searchin == 'desc')
        {
        $where_search= "WHERE game_desc LIKE '$search'";
        }

After I added:
elseif($searchin == 'champ')
        {
        $where_search= "c LEFT JOIN nuke_users w ON w.user_id = c.game_highuser
        WHERE w.username = '$search'";
        }


This should work with the next line to pull just the user name where the user id matches the game highuser id

$sql = "SELECT COUNT(*) as total_games FROM " . GAMES_TABLE . " $where_search";


I've added this line to heading_arcade.tpl to add the extra search option
<option value="champ">Champ's Name</option>


Anyway, I'm getting this error when I try a username search:

SQL Error : 1064 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 'c LEFT JOIN nuke_users w ON w.user_id = c.game_highuser WHERE w.username' at line 1

SELECT g.*, u.username, u.user_id, s.score_game, s.score_date FROM nuke_bbgames g left join nuke_users u on g.game_highuser = u.user_id left join nuke_bbscores s on s.game_id = g.game_id and s.user_id = 8 c LEFT JOIN nuke_users w ON w.user_id = c.game_highuser WHERE w.username = '%PTM%' ORDER BY game_name ASC

Line : 379
File : arcade_search.php


It seems to be combining what I've done with another query a few lines down and breaking things:

$sql = "SELECT g.*, u.username, u.user_id, s.score_game, s.score_date FROM " . GAMES_TABLE . " g left join " . USERS_TABLE . " u on g.game_highuser = u.user_id left join " . SCORES_TABLE . " s on s.game_id = g.game_id and s.user_id = " . $userdata['user_id'] . " $where_search ORDER BY $order_by";


I've tried a few other ways to do this hack but this approach seems to make the most sense. If anyone has any ideas what I'm doing wrong or how to do this another way I'd really appreciate it and when it's done I'll zip it up for download to share.

Thanks!



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum