What I'm trying to do is a repeat region for the record-display; and if no records exists, display an error message.
For some reason, this code cuts away the first record in the database:.
example: database had the following records:
Record1
Record2
Record2
Record3...
The code displays
Record2
Record3...
Here is the code before the <head> part:
Code: Select all
<?php require_once('Connections/connection.php'); ?>
<?php
$colname_Recordset1 = "1";
if (isset($HTTP_GET_VARSї'week'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARSї'week'] : addslashes($HTTP_GET_VARSї'week']);
}
$colname2_Recordset1 = "2002";
if (isset($HTTP_GET_VARSї'year'])) {
$colname2_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARSї'year'] : addslashes($HTTP_GET_VARSї'year']);
}
mysql_select_db($database_connection, $connection);
$query_Recordset1 = sprintf("SELECT * FROM playlist WHERE week = %s AND year = %s ORDER BY `order` ASC", $colname_Recordset1,$colname2_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $connection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>Code: Select all
<?php
if ($row_Recordset1 = mysql_fetch_assoc($Recordset1)){
do { ?>
<tr>
<td bgcolor="#CCCCCC"><div align="center"><?php echo $row_Recordset1ї'artists']; ?></div></td>
<td bgcolor="#CCCCCC"><div align="center"><?php echo $row_Recordset1ї'track']; ?></div></td>
<td bgcolor="#CCCCCC"><div align="center"><?php echo $row_Recordset1ї'order']; ?></div></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));}
else { ?>
<tr>
<td colspan="3" bgcolor="#CCCCCC" align="center"><?php echo "Sorry, but there is no Playlist for this week!" ?> </td>
</tr>
<?php }
?>