Forum Moderators: coopster
I have a problem and i have tried to fix it but don't get the right results. im wondering if this is actually possible to do.
I have a list of data on a php page.
its list all fields what begin with the letter a. then the user can select any of the letters from the alphabet and it displays all the data which begins with that letter.
my problem is a lot of the data starts with 'a name' or 'the item' or 'an item'
what i been trying to do is keep the title so it can be displayed in a details page, but on the list remove the words, 'a' 'an' 'the'.
i got this to work and the fields hide the words 'a' 'an' 'the' but on the list they still show in the A list or T list.
here is an example
original title is 'AN EXAMPLE' and is listed in the a list
with an hidden show 'EXAMPLE' but still in the a list.
i want it to be in the e list but still retain its real title
please could anyone point me in the right direction, im using php5 and mysql5
and Welcome to WebmasterWorld :)
this is the query and the tables
print("<p>$browsemenu<br>$pagemenu</p>");$offset = ($page * $perpage) - $perpage;
$res = mysql_query("SELECT npcs.id as npcid, npcs.level, npcs.name, npcs.diff, npcs.npctype, npcs.planet, npcs.zone, npcs.location, planet.id, planet.name as planetname, zone.id, zone.name as zonename, diff.id, diff.name as diffname FROM (npcs, planet, diff) LEFT JOIN zone ON (npcs.zone=zone.id) WHERE $query and npcs.diff=diff.id and npcs.planet=planet.id ORDER BY npcs.name LIMIT $offset,$perpage") or sqlerr();
$num = mysql_num_rows($res);print("<table border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=colhead align=left>Name</td><td class=colhead>Level</td><td class=colhead>Difficulty</td><td class=colhead>Planet</td><td class=colhead align=left>Zone</td><td class=colhead>Location</td><td class=colhead>NPC Type</td></tr>\n");
for ($i = 0; $i < $num; ++$i)
{
$arr = mysql_fetch_assoc($res);
$nname = stripslashes($arr['name']);
print("<tr><td align=left><a href=npcdetails.php?id=$arr[npcid]><b>$nname</b></a></td>" .
"<td>$arr[level]</td><td>$arr[diffname]</td><td>$arr[planetname]</td>".
"<td align=left>$arr[zonename]</td><td>$arr[location]</td><td>$arr[npctype]</td></tr>\n");
}
print("</table>\n");print("<p>$pagemenu<br>$browsemenu</p>");
[edited by: Mopreme at 8:42 pm (utc) on Oct. 9, 2008]