porko2004 Posted May 10, 2009 Share Posted May 10, 2009 WHERE c.profession = 45 AND c.name != '*[PM]' OR c.profession = 44 AND c.name != '*[PM]' OR c.profession = 43 AND c.name != '*[PM]' OR c.profession = 42 AND c.name != '*[PM]' OR c.profession = 41 AND c.name != '*[PM]' OR c.profession = 40 AND c.name != '*[PM]' i am making something appear i dont wont the database to show me accounts with name with something then [PM] eg home[PM] pime[PM] this is the script anyone know whast wrong c.name != '*[PM]' Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 You can use INSTR() function to check if c.name contains the string '[PM]' or not. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 You can use INSTR() function to check if c.name contains the string '[PM]' or not. example? this is full script <?php require('config.php'); $rank = mysql_query("SELECT c.name as CharName, c.level as Level, c.mate as Spouse, f.name as GuildName, c.money as Money, c.money_saved as Money_Saved FROM cq_user as c LEFT JOIN cq_synattr as g ON (c.id = g.id) LEFT JOIN cq_syndicate as f ON (g.syn_id = f.id) WHERE c.profession = 45 AND c.name != '*[PM]' OR c.profession = 44 AND c.name != '*[PM]' OR c.profession = 43 AND c.name != '*[PM]' OR c.profession = 42 AND c.name != '*[PM]' OR c.profession = 41 AND c.name != '*[PM]' OR c.profession = 40 AND c.name != '*[PM]' ORDER BY c.level DESC, c.money + c.money_saved DESC LIMIT 0,15 ;"); $i=1; echo "<table border='0' bgcolor='#FFDC74'> "; echo "<font size='9'><tr> <th><center> Rank </center></th> <th><center> Character Name </center></th> <th> Level </th> <th> Spouse </th> <th> Guild Name ; </th> </tr>"; while($row = mysql_fetch_array($rank)){ echo '<tr style="background-color:#FFF2BD;"><td><div align="center" bgcolor="#FFFF00" >'.$i.'</td> <td><div align="center">'.$row['CharName'].'</td> <td><div align="center">'.$row['Level'].'</td> <td><div align="center">'.$row['Spouse'].'</td> <td><div align="center">'.$row['GuildName'].'</td> </tr> '; $i=$i+1; } ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 WHERE INSTR('[PM]', c.name) = 0 ? Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 that doesnt work Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 that doesnt work That was helpful. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 that doesnt work That was helpful. can u add it to the script maybe im adding it wrong Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 WHERE INSTR('[PM]', c.name) = 0 AND c.profession BETWEEN 40 AND 45 ? Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 still the same Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 i fixed my problem but got a little question to ask <?php require('config.php'); $rank = mysql_query("SELECT c.name as CharName, c.level as Level, c.mate as Spouse, f.name as GuildName, c.money_saved as Money_Saved, c.money as Money, c.profession as profession FROM cq_user as c LEFT JOIN cq_synattr as g ON (c.id = g.id) LEFT JOIN cq_syndicate as f ON (g.syn_id = f.id) IF c.profession = 15 THEN 'Trojan Master' WHERE c.name != 'UnKnown[PM]' AND c.name != 'Bling[PM]' AND c.name != '~G~I~S~M~O~[PM]' ORDER BY c.level DESC, c.money + c.money_saved DESC LIMIT 0,15 ;"); $i=1; echo "<table border='0' bgcolor='#FFDC74'> "; echo "<font size='9'><tr> <th><center> Rank </center></th> <th><center> Character Name </center></th> <th> Level </th> <th> Spouse </th> <th> Guild Name </th> <th> Class </th></tr>"; while($row = mysql_fetch_array($rank)){ echo '<tr style="background-color:#FFF2BD;"><td><div align="center" bgcolor="#FFFF00" >'.$i.'</td> <td><div align="center">'.$row['CharName'].'</td> <td><div align="center">'.$row['Level'].'</td> <td><div align="center">'.$row['Spouse'].'</td> <td><div align="center">'.$row['GuildName'].'</td> <td><div align="center">'.$row['profession'].'</td> </tr> '; $i=$i+1; } ?> for profession it currectly appears as a number how do i make it appear as a name. Please help me. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Change it in the DB? ??? Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 Change it in the DB? ??? i cant. this script is web based if i do it in db i mess everything is there any other way Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Create an array that maps a profession number to some name? Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 ye Create an array that maps a profession number to some name? u know how to do it for example if there is a number 15 it appears as Novice Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 u know how to do it Yes. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 u know how to do it Yes. can u show me please Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 can u show me please Here's an example of what the array should look like. $professionNameMap = array( // profession => name 1 => 'one' ); Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 ?? im confused where i put that Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 It was an example. You know PHP? Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 It was an example. You know PHP? yes i do. i usually know what im doing but im seriously confused Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Okay so $row['profession'] returns a number right? Well if you were to call $professionNameMap[$row['profession']], then it should be the name specified. Get it now? Now you just have to set up the array. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 $profession = array( 10 => 'Noobie' 15 => 'Novace' ); doesnt work for multiple numbers Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 This is anoying Quote Link to comment Share on other sites More sharing options...
porko2004 Posted May 10, 2009 Author Share Posted May 10, 2009 can anyone help please Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Again, that was helpful. You need to learn how to ask a question. Next time, I won't even bother with this. Can you explain what you need help with? Quote Link to comment Share on other sites More sharing options...
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.