kingarmy Posted March 21, 2009 Posted March 21, 2009 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 'AND chSTATUS='open'' at line 1 Query was SELECT * FROM challenges WHERE chCHRCAR= AND chSTATUS='open' SQL entry: -- -- Table structure for table `challenges` -- CREATE TABLE `challenges` ( `chID` int(11) NOT NULL auto_increment, `chCHR` int(11) NOT NULL default '0', `chCHD` int(11) NOT NULL default '0', `chSTATUS` enum('open','accepted','declined','expired','cancelled') NOT NULL default 'open', `chCHRCAR` int(11) NOT NULL default '0', `chTYPE` enum('Friendly','Betted','High-Stakes') NOT NULL default 'Friendly', `chBET` int(11) NOT NULL default '0', `chTIME` int(11) NOT NULL default '0', PRIMARY KEY (`chID`) ) ENGINE=MyISAM AUTO_INCREMENT=51 DEFAULT CHARSET=latin1 AUTO_INCREMENT=51 ; Garage.php: { $count++; $acc=$r['cpcACCLV']*$r['carACC']; $han=$r['cpcHANLV']*$r['carHAN']; $spd=$r['cpcSPDLV']*$r['carSPD']; $shd=$r['cpcSHDLV']*$r['carSHD']; $q2=$db->query("SELECT * FROM challenges WHERE chCHRCAR={$r['cpcID']} AND chSTATUS='open'", $c); if(mysql_num_rows($q2) == 1) { $challenge="<font color='red'>Yes</font>"; } else { $challenge="<font color='green'>No</font>"; } print "<tr><td>{$r['carNAME']} </td> <td>Lv{$r['cpcACCLV']} ($acc)</td> <td>Lv{$r['cpcHANLV']} ($han)</td> <td>Lv{$r['cpcSPDLV']} ($spd)</td> <td>Lv{$r['cpcSHDLV']} ($shd)</td><td>$challenge</td> <td>[url='tune.php?id={$r[']Tune[/url]</td> </tr>"; $cars[$r['cpcID']]="{$r['carNAME']} - {$r['cpcACCLV']}/{$r['cpcHANLV']}/{$r['cpcSPDLV']}/{$r['cpcSHDLV']}"; } You don't have to give me the answer if you don't want to, maybe a hint. Quote
Dazza Posted March 22, 2009 Posted March 22, 2009 Re: Need help with sql Hint: Keep a copy or Google and/or Search feature Dont keep making topics please Quote
kingarmy Posted March 22, 2009 Author Posted March 22, 2009 Re: Need help with sql Lol I must of spent 6 hours only to find out I was missing a " EDIT: nvm Quote
kingarmy Posted March 22, 2009 Author Posted March 22, 2009 Re: Need help with sql damn now I don't know where to put the ". Quote
kingarmy Posted March 22, 2009 Author Posted March 22, 2009 Re: Need help with sql Someone another hint? EDIT: K I fixed that problem but now my cars won't show print " <table width=100% border=6> <tr style='background:#cc9966'><th>Horses</th><th>Acceleration</th> <th>Handling</th><th>Speed</th><th>Shield</th><th>In Challenge?</th><th>Tune</th></tr>"; $q=$db->query("SELECT cp.*, ct.* FROM cars_playercars cp LEFT JOIN cars_types ct ON cp.cpcCAR=ct.carID WHERE cp.cpcPLAYER=$userid LIMIT $start, $cpp", $c); $count=0; $cars=array(); while($r=mysql_fetch_row($q)) { $count++; $acc=$r['cpcACCLV']*$r['carACC']; $han=$r['cpcHANLV']*$r['carHAN']; $spd=$r['cpcSPDLV']*$r['carSPD']; $shd=$r['cpcSHDLV']*$r['carSHD']; $q2=$db->query("SELECT * FROM challenges WHERE chCHRCAR={$r['cpcID']} chSTATUS='open'", $c); if(mysql_num_rows($q2) == 1) { $challenge="<font color='red'>Yes</font>"; } else { $challenge="<font color='green'>No</font>"; } print "<tr><td>{$r['carNAME']} </td> <td>Lv{$r['cpcACCLV']} ($acc)</td> <td>Lv{$r['cpcHANLV']} ($han)</td> <td>Lv{$r['cpcSPDLV']} ($spd)</td> <td>Lv{$r['cpcSHDLV']} ($shd)</td><td>$challenge</td> <td>[url='tune.php?id={$r[']Tune[/url]</td> </tr>"; $cars[$r['cpcID']]="{$r['carNAME']} - {$r['cpcACCLV']}/{$r['cpcHANLV']}/{$r['cpcSPDLV']}/{$r['cpcSHDLV']}"; } if($count == 0) { print "<tr><th colspan=6>No Horses In Your stable</th></tr>"; } print "</table>"; -- -- Table structure for table `cars_playercars` -- CREATE TABLE IF NOT EXISTS `cars_playercars` ( `cpcID` int(11) NOT NULL auto_increment, `cpcPLAYER` int(11) NOT NULL default '0', `cpcCAR` int(11) NOT NULL default '0', `cpcACCLV` int(11) NOT NULL default '0', `cpcHANLV` int(11) NOT NULL default '0', `cpcSPDLV` int(11) NOT NULL default '0', `cpcSHDLV` int(11) NOT NULL default '0', PRIMARY KEY (`cpcID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=169 ; -- -- Dumping data for table `cars_playercars` -- INSERT INTO `cars_playercars` (`cpcID`, `cpcPLAYER`, `cpcCAR`, `cpcACCLV`, `cpcHANLV`, `cpcSPDLV`, `cpcSHDLV`) VALUES (168, 5, 1, 1, 1, 1, 1), (167, 5, 1, 1, 1, 1, 1), (166, 1, 1001, 1, 1, 1, 1), (165, 1, 1, 1, 1, 1, 1); Quote
TMan Posted March 22, 2009 Posted March 22, 2009 Re: Need help with sql Chances are if your mod is that buggy it was a free version. Am I correct? I only ask because "most" people will help if you have problems with their mods. Therefore your mod is buggy and you should fix it yourself. I found out that others with this car mod, with problems are only missing 2 variables haha. Quote
kingarmy Posted March 22, 2009 Author Posted March 22, 2009 Re: Need help with sql :? I still can't get it... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.