Link to home
Start Free TrialLog in
Avatar of doctorbill
doctorbillFlag for United Kingdom of Great Britain and Northern Ireland

asked on

php loops

These are my sql queries:
--------------------------------
mysql_select_db($database_egweb, $egweb);
$query_egweb = "SELECT * FROM eg_images";
$egweb = mysql_query($query_egweb, $egweb) or die(mysql_error());
$row_egweb = mysql_fetch_assoc($egweb);
$totalRows_egweb = mysql_num_rows($egweb);
$totalRows_egwebb = mysql_num_rows($egweb);
---------------------------------

This is in the body tag:

<?php do { ?>
       
 <a class='highslide' href='<?php echo $row_egweb['eg_lge']; ?>' title="<?php echo $row_egweb['eg_title']; ?>"
 onclick="return hs.expand(this, miniGalleryOptions1)">
      <img src='<?php echo $row_egweb['eg_thumb']; ?>' alt=''/></a>
           
            <?php } while ($row_egweb = mysql_fetch_assoc($egweb)); ?>

What I need to do is to get th Do loop to start showing images from the table row with an ID of > 4. As it stands at the moment, the code is working but is duplicating the first image
Can anyone help please ?
Avatar of StingRaY
StingRaY
Flag of Thailand image

Try this

<?php
// query things
mysql_select_db($database_egweb, $egweb);
$query_egweb = "SELECT * FROM eg_images";
$egweb = mysql_query($query_egweb, $egweb) or die(mysql_error());
$totalRows_egweb = mysql_num_rows($egweb);
$totalRows_egwebb = mysql_num_rows($egweb);
?>

// body
<?php
while ($row_egweb = mysql_fetch_assoc($egweb)) { ?>
        
 <a class='highslide' href='<?php echo $row_egweb['eg_lge']; ?>' title="<?php echo $row_egweb['eg_title']; ?>"
 onclick="return hs.expand(this, miniGalleryOptions1)">
      <img src='<?php echo $row_egweb['eg_thumb']; ?>' alt=''/></a>
            
<?php } ?>

Open in new window

SOLUTION
Avatar of Scott Madeira
Scott Madeira
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of doctorbill

ASKER

I think you have not read this line:

What I need to do is to get the Do loop to start showing images from the table row with an ID of > 4.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Comment to Ray:
I am very glad that someone with your experience recomends the sitepoint php book - I purchased this a few weeks ago but have not got round to reading it yet. I will do so
All solutions had their merits and , combined, solved my problem