Jump to content

sql query to show only some fields


nadz

Recommended Posts

In php:
[code]
<?php

$select = mysql_query("SELECT field_1, field_2 FROM table") or die(mysql_error());
while($col = mysql_fetch_array($select, MYSQL_ASSOC)
{
foreach($col as $fieldname => $value)
{
${$fieldname} = $value;
}

echo $field_1;
echo $field_2;
}

?>
[/code]

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.