dietkinnie Posted May 5, 2009 Share Posted May 5, 2009 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 More sharing options...
gnawz Posted May 5, 2009 Share Posted May 5, 2009 Save the data in the database and read it back using variables. have a panel for adding code. Then read it back using loops and variables Link to comment https://forums.phpfreaks.com/topic/156923-static-code-to-dynamic-code/#findComment-826622 Share on other sites More sharing options...
Axeia Posted May 5, 2009 Share Posted May 5, 2009 If you got mysql available do some reading over at w3schools If you don't have it available, next best thing would probably be includes Link to comment https://forums.phpfreaks.com/topic/156923-static-code-to-dynamic-code/#findComment-826627 Share on other sites More sharing options...
dietkinnie Posted May 5, 2009 Author Share Posted May 5, 2009 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 !! Link to comment https://forums.phpfreaks.com/topic/156923-static-code-to-dynamic-code/#findComment-826672 Share on other sites More sharing options...
Ken2k7 Posted May 5, 2009 Share Posted May 5, 2009 You want to link the entire DIV to that URL? Link to comment https://forums.phpfreaks.com/topic/156923-static-code-to-dynamic-code/#findComment-826711 Share on other sites More sharing options...
Zhadus Posted May 5, 2009 Share Posted May 5, 2009 You could create a separate table and use "JOIN" within MySQL to use a value for a web address where you would relate the id of "Hihihihihihihihihihihihih" to "www.example.com". Link to comment https://forums.phpfreaks.com/topic/156923-static-code-to-dynamic-code/#findComment-826836 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.