php - first iteration of sql query not being wrapped properly -
So, I've got this php file, but the first result is not being wrapped in the 'result' div, and therefore Not being styled properly. All subsequent results are wrapped properly. help?
Edit: According to the comment, I have tried to pull out HTML. I believe that I am a Noble, but here I have come for it. The original problem does not seem to fix:
scripts_post.php:
$ connection = mysqli_connect ("server", "user "," Password "," dbname "); If (mysqli_connect_errno ()) {echo "failed to connect to MySQL:". Mysqli_connect_error (); } $ Result = mysqli_query ($ connection, $ sqlQuery); Mysqli_close ($ connection); If (empty ($ result)) {echo 'no results found'; Return; } While ($ line = mysqli_fetch_array ($ result)) {echo included 'single_result.php'; } Echo " gt; & lt; p & gt; The end of the list & lt; / p & gt; & lt; / div & gt;"; single_result.php:
& lt; Div class = 'result' & gt; & Lt; Div class = 'result_left' & gt; & Lt; Div class = 'result_photo' & gt; & Lt; Img src = & lt ;? Php Echo "'". $ Line ['photolink']. "'"? & Gt; Height = '200' width = '200' square = 'script_photo' & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = 'results_right' & gt; & Lt; Div class = 'result_title' & gt; & Lt ;? Php echo $ line ['title']? & Gt; & Lt; / Div & gt; & Lt; Div class = 'result_summary' & gt; & Lt ;? Php echo $ line ['summary']? & Gt; & Lt; / Div & gt; & Lt; Div class = 'result_description' & gt; & Lt ;? Php echo $ line ['description']? & Gt; & Lt; / Div & gt; & Lt; Div class = 'result_preview' & gt; & Lt; A href = & lt ;? Php echo '' ''. $ Line ['preview length'] "'"? & Gt; Target = '_ blank' & gt; View Preview & lt; / A & gt; & Lt; / Div & gt; & Lt; Div class = 'result_detail' & gt; Type: & lt ;? Php echo $ row ['type']? & Gt; & Lt; / Div & gt; & Lt; Div class = 'result_detail' & gt; Biblical characters painted: & lt ;? Php echo $ row ['biblical chatter']? & Gt; & Lt; / Div & gt; & Lt; Div class = 'result_detail' & gt; Subject: & lt ;? Php echo $ row ['subject']? & Gt; & Lt; / Div & gt; & Lt; Div class = 'result_price' & gt; Price: $ & lt ;? Php echo $ line ['value']? & Gt; & Lt; / Div & gt; & Lt; Div class = 'result_purchase' & gt; & Lt; A href = & lt ;? Php Echo "'". $ Line ['download link']. "'"? & Gt; Target = '_ blank' & gt; & Lt; Img src = 'http: //image.payloadz.com/images/btn-addtocart-b.png' border = '0' & gt; & Lt; / A & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; Edit # 2: Here's what is saying above, maybe there is something here that needs to be screwed with things? & lt; Script src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script language = "javascript" & gt; $ (Function () {$ ('form'). Submit (function (event) {var form = $ (this); $ .gend ({type: form.attr ('method'), url: form.attr ('Action'), data: form.serialize ()} done (function (return_data) {document.getElementById ('scriptsearch_results_div'). InnerHTML = return_data;}). Unsuccessful (function () {alert ("Search is failed Please alert the webmaster. ");}); Event.preventDefault ();});}); & Lt; / Script & gt; ... & lt; Div id = "form container" & gt; & Lt; Form id = "scriptsearch_form" action = "scripts_post.php" method = "post" & gt; // form field & lt; P & gt; & Lt; Input type = "submit" value = "search" class = "submit button" id = "mainsubmitbutton" & gt; & Lt; / P & gt; & Lt; / Form & gt; & Lt; / Div & gt; & Lt; Div id = "scriptsearch_results_div" & gt; & Lt; P & gt; Search the scripts using the options on the left. & Lt; / P & gt; & Lt; / Div & gt;
You have to remove the 'result' div from php loop. In other words, the nest is the 'result result'
inside the PHP loop
Comments
Post a Comment