Jump to content

Static code to dynamic code


dietkinnie

Recommended Posts

Hi Everyone,

 

My current slide show uses static data to display images.

 

<div id="feature_gallery">
<div class="bigimg" title="http://farm2.static.flickr.com/1429/1252247669_5f014e7dc1_b.jpg" id="piknown printer took a galley of 1"> <img src="http://farm2.static.flickr.com/1429/1252247669_5f014e7dc1_b.jpg" class="change" ></div>
  <div class="bigimg" title="http://farm1.static.flickr.com/153/332584527_bd5efc0197_o.jpg" id="picLorem Ipstext of tnpsum hadu typa type spec"> <img src="http://farm1.static.flickr.com/153/332584527_bd5efc0197_o.jpg" class="change" ></div>
  <div id="output"></div>
  <a href="http://design-notes.info/tutorial/jquery-tutorial/how-to-creat-a-feature-article-slide-show-with-thumbnails-and-indicator/">Article</a>
</div>

 

I now need to insert that data into my db , loop the data an output it in the same syntax ax above , but am not sure how to to do so.

 

Can anyone help me here , or point me in the correct direction ?

 

Thanks in advance !!  ;)

 

//DK

 

 

Link to comment
https://forums.phpfreaks.com/topic/156923-static-code-to-dynamic-code/
Share on other sites

OK i have finally got the code working

 

<?php

include  '/var/www/html/oddssurf/config.php';

  $result = mysql_query("SELECT * FROM SLIDESHOW") or die(mysql_error());
  $count = mysql_num_rows($result);
  //print_r($count); //check count of rows in table

  while ($row = mysql_fetch_array($result)) {


  echo "<div class=\"bigimg\" title=\"$row[title]\"id=\"$row[id]\"><img src=\"$row[imgsrc]\" class=\"change\"></div>\n";

}
?>

 

Can anyone tell me if its possible to link the ID to a specific url?

 

The output of the above code is:

 

The output of the above code is

 

<div class="bigimg" title="http://farm2.static.flickr.com/1429/1252247669_5f014e7dc1_b.jpg"id="Hihihihihihihihihihihihih"><img src="http://farm2.static.flickr.com/1429/1252247669_5f014e7dc1_b.jpg" class="change"></div>

 

Now i would like to link "id = "Hihihihihihihihihihihihih" to www.example.com. Is this possible ?

 

Thanks in advance  ;)  !!

 

 

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.