valdepenas Posted October 28, 2009 Share Posted October 28, 2009 Hi, I'm a total noob, and this makes no sense to me. My query (using the PHP MySQL functions) does actually execute with no errors per se, but as it's executing, it seems each time through the loop is creating a dot that prints out to the page, before the search results are rendered. The more results a query has, it seems the number of dots grows. These dots don't show up when you "view source" in a browser. They also render differently in different browsers, as shown in these screenshots: CHROME http://imgur.com/HXggB.png FIREFOX http://imgur.com/9YPVR.png OPERA http://imgur.com/RbChL.png This is the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>lcws search (live)</title> </head> <body> <p> <a href="http://blah">Return to Menu</a> </p> <h1>Search For A Product</h1> <hr style="border:1px solid red;"> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <input type="text" name="q" /> <input type="submit" name="ElSubmit" value="SELECT" style="background:yellow;"/> </form> <?php // Get the search variable(S) from URL $s = @$_POST['s'] ; // this crucial line was missing from original script!!!!!!!!!!!!!!!!!!!!!!! $var = @$_POST['q'] ; $trimmed = trim($var); //trim whitespace $trimmed = str_replace("%","\%",$trimmed); // escape percentage signs // best thing I could probably do with apostrophes is not use them in db // and strip them out of $trimmed // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } // Connects to your Database require_once('includes/inc.dbconnect.php'); //Here we count the number of results // next line has to be included here, but can't be included in the edit module --why?! mysql_query("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci'"); $query = "select * from vuPHP_searchProducts where productName like \"%$trimmed%\" order by productName"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // rows to return //$limit=25; // If we have no results, tell the user if ($numrows == 0){ echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; } else { // next determine if s has been passed to script via the URL in the links below, if not use 0 if (empty($s)) { $s=0; } // get results // $query .= " limit $s,$limit"; $result = mysql_query($query) or die(mysql_error()); // display what the person searched for echo "<p>Here are the results for your search for <strong> "" . $var . "" </strong></p>"; // many many dots print out here for some reason; number of dots increase with // number of rows returned // also noticed NEXT link isn't working as of october 6, 2009 echo '<table border="1" cellpadding="4"><tr> .<th>Count</th> .<th>product Name</th> .<th>Size</th> .<th>Rep</th> .<th>Retail</th> .<th>Edit</th> .<th>View Private Detail</th> .<th>View Public Detail</th> .</tr>'; $count = 1 + $s ; // now you can display the results returned while ($row = mysql_fetch_array($result)) { $idItemNum = $row["idItemNum"]; $productName = $row["productName"]; $size = $row["size"]; $rep = $row["rep"]; $retail = $row["retail"]; echo " <tr> .<td>$count</td> .<td>$productName</td> .<td>$size</td> .<td>$rep</td> .<td>$retail</td> .<td class='bodyRight'><a href='editProduct.php?idItemNum=$idItemNum'>Edit</a></td> .<td class='bodyRight'><a href='viewDetailsPrivate.php?idItemNum=$idItemNum'>Private Details</a></td> .<td class='bodyRight'><a href='viewDetailsPublic.php?idItemNum=$idItemNum'>Public Details</a></td> .</tr>"; $count++ ; } echo "</table>"; } // end of else block ?> </body> </html> Have you ever seen anything like this? Any ideas what would cause this annoyance? Thanks for any ideas Quote Link to comment https://forums.phpfreaks.com/topic/179405-solved-running-mysql-query-yields-a-bunch-of-dots-in-the-rendered-html/ Share on other sites More sharing options...
MadTechie Posted October 28, 2009 Share Posted October 28, 2009 I'm sure they do appear in source, you probably have echo "." in a loop some where Quote Link to comment https://forums.phpfreaks.com/topic/179405-solved-running-mysql-query-yields-a-bunch-of-dots-in-the-rendered-html/#findComment-946619 Share on other sites More sharing options...
valdepenas Posted October 28, 2009 Author Share Posted October 28, 2009 Ok I feel dumb now lol I tried taking out my concatenation operators (I thought I had to concatenate if I was splitting up an echo statement across multiple lines in my editor), and that removed my dots. Thanks for pointing this out to me Quote Link to comment https://forums.phpfreaks.com/topic/179405-solved-running-mysql-query-yields-a-bunch-of-dots-in-the-rendered-html/#findComment-946627 Share on other sites More sharing options...
MadTechie Posted October 28, 2009 Share Posted October 28, 2009 LOL, well you found it.. that's the main thing Quote Link to comment https://forums.phpfreaks.com/topic/179405-solved-running-mysql-query-yields-a-bunch-of-dots-in-the-rendered-html/#findComment-946629 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.