Timalan Posted April 18, 2013 Share Posted April 18, 2013 I am a Noob at javascript so here goes. I have a slider carousel that is displayed when the webpage loads. It displays a line of images that when clicked on are displayed in larger form below it. I just want know how to automatically load (when the page firsts loads) the last uploaded on the page and then when another image is clicked from the slider carousel its loaded in its place?2 files index and getuser.phpindex.php< script type="text/javascript">jQuery(document).ready(function() {jQuery('.first-and-second-carousel').jcarousel()jQuery('#mycarousel').jcarousel({start: 5});});function showUser(str){if (str==""){document.getElementById("txtHint").innerHTML="";return;}if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safarixmlhttp=new XMLHttpRequest();}else{// code for IE6, IE5xmlhttp=new ActiveXObject("Microsoft\l ".XMLHTTP");}xmlhttp.onreadystatechange=function(){if (xmlhttp.readyState==4 && xmlhttp.status==200){document.getElementById("txtHint").innerHTML=xmlhttp.responseText;}}xmlhttp.open("GET","getuser.php?q="+str,true);xmlhttp.send();}</script><ul id="first-carousel"class\l "="first-and-second-carousel jcarousel-skin-tango"><li><?php$con = mysql_connect("localhost","base","password");if (!$con){die('Could not connect: ' . mysql_error());}mysql_select_db("users", $con);$sql = "SELECT * FROM contest ORDER BY member_id DESC";$result = mysql_query($sql);while($file = mysql_fetch_array($result)){echo '<li>';echo '<a href="#" id="'.$file['member_id'].'" onclick="showUser(this.id)"><img src="'.$file['filelocation'].'" width="80" height="95" border="1"></a>';echo '</li>';}mysql_close($con);?></li></ul><div id="txtHint" style="text-align: center;"> </div>--------------------------------------------------------------------getuser.php< ?php$q=$_GET["q"];$con = mysql_connect("localhost","base","password");if (!$con){die('Could not connect: ' . mysql_error());}mysql_select_db("users", $con);$sql="SELECT * FROM contest WHERE member_id = '".$q."'";$result = mysql_query($sql);while($file = mysql_fetch_array($result)){echo '<div align="center" ><img src="'.$file['filelocation'].'" width="650" height="500" border="0"><br>< td>'.$file['title'].'</td><td><br>< td>'.$file['description']. '</td>< /div>';}mysql_close();?> Quote Link to comment https://forums.phpfreaks.com/topic/277126-onload-last-uploaded-entry-when-website-first-loads-then-if-any-slider-images-are-clicked-on-display-that-image/ Share on other sites More sharing options...
bleured27 Posted April 24, 2013 Share Posted April 24, 2013 please put your codes between code taggs so it's easy reading. Quote Link to comment https://forums.phpfreaks.com/topic/277126-onload-last-uploaded-entry-when-website-first-loads-then-if-any-slider-images-are-clicked-on-display-that-image/#findComment-1426245 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.