Seven_Rings Posted October 14, 2008 Share Posted October 14, 2008 *I hope this is the right forum.* All the folowing needs to be done with PHP+MySQL. All my code is in PHP. $result = mysql_query("SELECT * FROM table") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { //How do I use a string in here? echo $row[$string . 'level']; } I have tried a few differant things, none of which work. These are two examples. echo $row['$stringlevel']; echo $row[$string . 'level']; I am trying to pull certain results from my table. And those results need to be defined by that string. If the string = seven, than I want to pull all entrys from sevenlevel. Trust me, I am fine on everything else, all I need is simply to know how to use a string in that code. Thanks in advance, -Seven_Rings Link to comment https://forums.phpfreaks.com/topic/128315-need-to-use-a-sting-to-display-part-of-a-resultset/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.