ldb358 Posted June 9, 2009 Share Posted June 9, 2009 what this is should do is echo the put the output in the picSelect div but instead they apear on top see what i mean on my site: username:Lane password:enter1 heres my code: function userPage(){ $username = $_SESSION['username']; $qFirst = mysql_query("SELECT firstName FROM users WHERE username='$username'"); $qLast = mysql_query("SELECT lastName FROM users WHERE username='$username'"); $qEmail = mysql_query("SELECT email FROM users WHERE username='$username'"); $firstb = mysql_fetch_array($qFirst); $first = $firstb['firstName']; $lastb = mysql_fetch_array($qLast); $last = $lastb['lastName']; $emailb = mysql_fetch_array($qEmail); $email = $emailb['email']; $qgetImagesrc = mysql_query("SELECT * FROM ".$username." WHERE id='1'") or die(mysql_error()); $qImagesrc = mysql_fetch_array($qgetImagesrc); //working on designing the page here echo "<div class='body3'><div style='width:800px; height:20px;'></div><div class='pictureFill'><img src='". $username . "/" . $qImagesrc['name'] ."' style='width:100; height:150;'/></div><div class='userInfo'><blockquote><h3>$username</h3><p>$first $last<br/>$email<h4>$rating</h4></p></blockquote></div><br/><div class='pictureSelect' id='picSelect'>".loadImages($username);."</div><div class='pictureGallery'><img name='mainImage' /></div></div>"; //add an if(isset(img1) else load upload first page } function loadImages($username){ $numberOfImages = mysql_query("SELECT imgNumber FROM users WHERE username='$username'"); $numImages2 = mysql_fetch_array($numberOfImages); $numImages = (int)$numImages2['imgNumber']; for( $i=1; $i<=$numImages; $i++){ echo $i; $getName = mysql_query("SELECT name FROM ".$username." WHERE id='$i'"); $loadName = mysql_fetch_array($getName); $name = $loadName['name']; echo "<input type='button' value='$name' onClick=\"mainImage.src='" . $username . "/" . $name . "' \"/><br/>"; } } Link to comment https://forums.phpfreaks.com/topic/161592-parts-of-web-page-loading-on-top-of-webpage/ Share on other sites More sharing options...
dawsba Posted June 9, 2009 Share Posted June 9, 2009 dont use echo's inside your functions function simple() { $blah = format_a(format_b*2)); return $blah; } in your script where you want the code call your function echo simple(); //echo the function not from inside the function. Link to comment https://forums.phpfreaks.com/topic/161592-parts-of-web-page-loading-on-top-of-webpage/#findComment-852687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.