Jump to content

field name into a variable


alarik149

Recommended Posts

Try this:
[code]<?php
$q = "select * from tablename";
$rs = mysql_query($q) or die('problem with query: ' . $q . '<br />' . mysql_error());
while ($rw = mysql_fetch_assoc($rs))
     foreach ($rw as $key => $value)
          if ($value == 'abcdef') echo 'The field ' . $key . " holds the value<br />\n";
?>[/code]

Ken

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.