Jump to content

anyone know how to fix this


porko2004

Recommended Posts

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]'

Link to comment
https://forums.phpfreaks.com/topic/157548-anyone-know-how-to-fix-this/
Share on other sites

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;
}


?>

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.

Archived

This topic is now archived and is closed to further replies.

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