Hi Hacook,

> I have a mySQL database called "srchresult"  in a "srchresult" base.
> In it, i have 9 fields. Everything works perfectly.
> I would like to know how can  i list in a HTML table 30 results for
example
> but only with 7 columns (7 fields only) ?

Try this:

<?php

// open the db connection - replace these with your own settings
$db = mysql_connect([server], [username], [password]);

// select the database - replace with your own
mysql_select_db([database], $db);

// get the query - add your own field names here
$q = mysql_query("SELECT Field1, Field2, Field3 FROM srchresult LIMIT 30");

// start the table
echo "<table">;

// loop through the results
while ($r = mysql_fetch_array($q)) {

  // echo a table row
  ?>
    <tr>
      <td><?=$r["Field1"]?></td>
      <td><?=$r["Field2"]?></td>
      <td><?=$r["Field3"]?></td>
    </tr>
  <?php

// end of while() loop
}

// finish the table
echo "</table>";

?>

It's untested - shout if it doesn't work.

Cheers
Jon





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to