I am wondering how I would go about displaying 1 entry from a database that has 2 entries in it.
For example: in the database I am using, it has a column called 'item' which has the following "[`U_C_Poloshirt_stripped`,`Commoner Clothes (Striped)`]"
and in php script, I have this echo "<td>" . $row["item"] . "</td>";
What I am wanting to do, is have the above php show just the second part of the item.. for example
echo "<td>" . $row["item"] . "</td>";
I'm wanting to display
Commoner Clothes (Striped)
Only
I have tried to make a function
function clothNames($clothes)
{
if($clothes == 'U_C_Poloshirt_stripped') return 'Commoner Clothes Striped';
else return $clothes;
}
and tried to call it;
echo "<td>" . $clothes($row["item"]) . "</td>";
But obviously didn't work, and seeing as I'm new to PHP I am not sure how to make this work, if it even will work.
Thanks
question from:
https://stackoverflow.com/questions/65829882/displaying-1-entry-from-database-with-2-entries-entered 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…