Infernalx Posted May 12, 2011 Share Posted May 12, 2011 First of all hello, OK,there's my question first of all nothing its wrong with this php script but i want to know how to add a image as result of each classes example $classes = array('0' => "Azure Knight", '1' => "Segita Hunter", '2' => "Incar Magician", '3' => "Vicious Summoner", '4' => "Segnale", '5' => "Bagi Warrior"); i want to change those result Azure,segita,etc for a image like /azure.jpg ,dont know how to explain it better...Thanks for read [m]<?php $msconnect = mssql_connect("localhost","sa","sacha29"); echo "<center>Top 50 List<br><font size='1'>Sortiert nach Level</font><br>"; echo "<table border='1'> <tr> <td align='center'>Pos.</td> <td align='center'>Char.Name</td> <td align='center'>Level</td> <td align='center'>Class</td> <td align='center'>Guild</td> <td align='center'>PK's</td> <td align='center'>PvP's</td> </tr>"; $con = mssql_connect($mssql['host'],$mssql['user'],$mssql['pass']) or die("Verbinndung zum MSSQL Server fehlgeschlagen,bitte zu einem späteren zeitpunkt erneut probieren."); $result1 = mssql_query(" SELECT c.character_name,c.wLevel,c.byPCClass,c.dwPVPPoint,c.wPKCount, (SELECT guild_code FROM character.dbo.GUILD_CHAR_INFO WHERE character_name = c.character_name) AS guildcode FROM character.dbo.user_character AS c WHERE character_name <> '[' AND character_name <> ']' AND user_no < '9999999999' ORDER BY wLevel DESC,dwExp DESC",$con); $i = '1'; $classes = array('0' => "Azure Knight", '1' => "Segita Hunter", '2' => "Incar Magician", '3' => "Vicious Summoner", '4' => "Segnale", '5' => "Bagi Warrior"); while($row1 = mssql_fetch_row($result1)) { if($i >= '0' || $i <= '50') { if(!preg_match("/[[]/i",$row1[0])) { if(empty($row1[5])) { $guildname = "No Guild"; } else { $result2 = mssql_query("SELECT guild_name FROM character.dbo.GUILD_INFO WHERE guild_code = '".$row1[5]."'",$con); $row2 = mssql_fetch_row($result2); $guildname = $row2[0]; } echo "<tr> <td align='center'>".$i."</td> <td align='center'>".$row1[0]."</td> <td align='center'>".$row1[1]."</td> <td align='center'>".$classes[$row1[2]]."</td> <td align='center'>".$guildname."</td> <td align='center'>".$row1[4]."</td> <td align='center'>".$row1[3]."</td> </tr>"; $i++; } } } echo "</table></center>"; ?> Link to comment https://forums.phpfreaks.com/topic/236200-php-scripting/ Share on other sites More sharing options...
fugix Posted May 12, 2011 Share Posted May 12, 2011 $classes = array('0' => "Azure Knight", '1' => "Segita Hunter", '2' => "Incar Magician", '3' => "Vicious Summoner", '4' => "Segnale", '5' => "Bagi Warrior"); Foreach($classes as $k=>$v). { Echo "<img src='{$v}.jpg' />"; } however the space in the names might cause a problem. I would advise adding an underscore or some connecting character instead Link to comment https://forums.phpfreaks.com/topic/236200-php-scripting/#findComment-1214428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.