hey drew010, i did what you said and put the query on the page which didn't see it and it is working now, thank you ever so much for your help 😃
also, i have got another little problem using the select statement and that is when i use it, it displays the limited data but all the column headers so do you know how to get rid of the redundent column headers?
here is the code i am using
function viewBottomSix($table, $where){
/* function to view a table in a html table, with column headings
$where is an optional SQL where clause used to limit the rows selected*/
global $DBHOST, $DBUSER,$DBPASSWORD,$DBDATABASE;
/* first connect to the database */
$dbcnx = myconnect();
/* now get the column headers */
$fields = mysql_list_fields($DBDATABASE, $table, $dbcnx);
$columns = mysql_num_fields($fields);
/* start a table to put things in then loop round and put in the headers */
?> <table border="1"> <?php
for ($j = 0; $j < $columns; $j++) { ?>
<td> <?php echo(mysql_field_name($fields, $j)); ?> </td>
<td> <?php };
?> <tr> <?php
/* now get the data */
$query = "SELECT Pos,clubID,P,Pts FROM $table $where ORDER by pos asc LIMIT 18 , 24;";
if (! mysql_query($query))
printf ("Error: %s<br>%s<br>", mysql_error (), $query);
$result = mysql_query($query);
/* and work through the data row by row creating a line in the table */
$i = 0;
while ($i < mysql_num_rows ($result)) {
$row = mysql_fetch_array($result);
for ($j = 0; $j < $columns; $j++) { ?>
<td> <?php echo($row[mysql_field_name($fields, $j)]); ?> </td>
<td> <?php
};
?> <tr> <?php
$i++;
};
/* now close the table */
?> </table> <?php
};
thank you again