Jump to content

Need to use a sting to display part of a resultset.


Seven_Rings

Recommended Posts

*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

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.