PHP - Mystery
$sql = "SELECT * FROM dczcat1 ORDER BY position";
if ($result = $mysqli->query($sql)){ if ($result->num_rows > 0){ while ($row = $result->fetch_array()){ $table=$row[cattable]; echo"$table"; $scat2=$table . 2; echo"$csat"; $cat=$row[cat]; echo"$cat"; $sql="SELECT * FROM $table ORDER BY position"; echo"$sql"; if($result=$mysqli->query($sql)){ if($result->num_rows>0){ echo"Pumpkin"; while ($row = $result->fetch_array()){ echo"<br />should not be displayed if it doesn't say Pumpkin above"; $level+=1; echo"LEVEL69:$level"; echo<<<HTML <div class = "menutitles" onmouseover="document.getElementById('$table').style.display='block';document.getElementById('$scat2').style.display='block';" onmouseout="document.getElementById('$table').style.display='none';document.getElementById('$scat2').style.display='block';" > <a class="topseltxt2" href="gem.php?cat=$fullcat">$cat pos44</a><br/> <div class="contain" id="$table"> <div class="menuitems" id="$scat2"> HTML; $table=$row[cattable]; echo "$table"; $scat2= $table . 2; echo "$scat"; $cat = $row[cat]; echo "$cat"; select($cat, $table, $scat2, $mysqli, $level); } }else if($level==1){echo" <a class='topseltxt' href='gem.php?cat=$table'>$cat pos2</a><br/> "; echo"table:$table"; }else{ While($row=$result->fetch_array()){ $table=$row[cattable]; $scat2= $table . 2; $cat = $row[cat]; echo" <a class='topseltxt2' href='gem.php?cat=$table'>$cat pos3</a><br/> ";} $level-=1; } }else{ die("ERROR: Could not execute query $sql." . $mysqli->error); }echo"</div> </div> </div>"; } } }else{ die("ERROR: Query failed: $sql." . $mysqli->error); } At line 15 it says echo "Pumpkin" and below after the while loop it says "should not be displayed unless it says pumpkin above" When I run the above code it displays: should not be displayed unless it says pumpkin above No Pumpkin, how is this possible, if num_rows is greater than 0, then it should either display the word pumpkin, or it should skip everything between the {}'s shouldn't it? I don't want the while loop to run if num_rows is greater than 0, but it does and I'm sure it shouldn't be. Similar TutorialsI am getting the following error from my error handler (shown below). I don't know if it is related, but I am using register_shutdown_function in a static class. I don't even know where to start troubleshooting. Any recommendations? Thanks
An error occurred in script 'Unknown' on line 0: Unknown: Skipping numeric key 2996699736 (error no: 8 ) <?php function my_error_handler($e_number, $e_message, $e_file, $e_line, $e_vars) { $message = "An error occurred in script '$e_file' on line $e_line: $e_message (error no: $e_number)";//.print_r($e_vars,1); syslog(LOG_INFO,'my_error_handler: '.$message); } ini_set('display_errors', 1); error_reporting(E_ALL); set_error_handler("my_error_handler"); ?> Edited by NotionCommotion, 20 November 2014 - 01:29 PM. Good morning Experts! My code creates a PNG file output 505 x 600 pixels, 24bit, 96dpi. The average file size is 130kb. No mystery there. Here is the mystery: when I open the file using ACDSee (v10) and then "save as" (even with the same filename), the file size SHRINKS to about 80kb. All the specs remain the same and I can see no difference in the image! How in the world... What could an ACDSee file-save-as be doing and how do I do it in PHP? Doing a file-save-as in Windows Paint has the same result! So I have tried to reduce the filesize in the code using compression and filters: from imagepng($Image, $ImageName) to imagepng($Image, $ImageName, 9, PNG_ALL_FILTERS). No difference. I tried running through PNGCRUSH, file size only goes to 112kb. The mystery is driving me crazy. Any ideas of what to check in my code or image? Any ideas of tricks to try in the code? A 30% filesize reduction is too great to ignore. I've attached a not-yet-shrunk file for your entertainment (It appears that the upload program wont allow my original as it is 120kb) Thank you in advance for all your ideas! I have a registration page that mails a link to the users email. The link in the email takes the user to the activation page which sends out a welcome email and updates the database as activated if the user is not already activated. For some reason, this page is being accessed by an Amazon ip address with multiple browsers in the user_agent. Whatever this is is automatically activating my users and sending them a welcome email without them even accessing the page. The only suspect I can think of is I have a javascript snippit for google ads and also facebook on some of my pages. I don't know if they could somehow be accessing the page or not. It must be following the activation link in the mail() script I have on the registration page. I'm mailing myself the following when the activation page is accessed. I get an amazon ip, multiple browsers, and no referer. $browser = $_SERVER['HTTP_USER_AGENT']; $ip = $_SERVER['REMOTE_ADDR']; $referer = $_SERVER['HTTP_REFERER'];
|