Tenaciousmug Posted January 8, 2012 Share Posted January 8, 2012 Ok, the sql seems to be working fine, but when I go into the while loop, it gives me an internal error 500 and doesn't load anything. It just shows me a blank white screen: $sql = "SELECT alertID,alertName,alertMessage,activateSubj,activateBody,deactivateSubj,deactivateBody FROM alerts ORDER BY alertName"; $result = mysqli_query($cxn, $sql) or die(mysqli_error()); while ($row = mysqli_fetch_assoc($result)) { $alertID = $row['alertID']; $alertName = stripcslashes($row['alertName']); $alertMessage = stripcslashes($row['alertMessage'])); $activateSubj = stripcslashes($row['activateSubj'])); $activateBody = stripcslashes($row['activateBody'])); $deactivateSubj = stripcslashes($row['deactivateSubj'])); $deactivateBody = stripcslashes($row['deactivateBody'])); <div class="alert" style="border:1px solid #000;border-radius:5px;padding:12px;"> echo $alertID."<br />"; echo $alertName."<br />"; echo $alertMessage."<br />"; echo $activateSubj."<br />"; echo $activateBody."<br />"; echo $deactivateSubj."<br />"; echo $deactivateBody."<br />"; </div> } Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 8, 2012 Share Posted January 8, 2012 You have a block of html right in the middle that isn't quoted and echoed. It's just kind of there. And why stripcslashes()? Quote Link to comment Share on other sites More sharing options...
Tenaciousmug Posted January 8, 2012 Author Share Posted January 8, 2012 Oh wow... I can't believe I did that. I'm sorry. I never did that before. I'm so retarded. xD Here is my updated code: $sql = "SELECT alertID,alertName,alertMessage,activateSubj,activateBody,deactivateSubj,deactivateBody FROM alerts ORDER BY alertName"; $result = mysqli_query($cxn, $sql) or die(mysqli_error()); while ($row = mysqli_fetch_assoc($result)) { $alertID = $row['alertID']; $alertName = stripcslashes($row['alertName']); $alertMessage = stripcslashes($row['alertMessage'])); $activateSubj = stripcslashes($row['activateSubj'])); $activateBody = stripcslashes($row['activateBody'])); $deactivateSubj = stripcslashes($row['deactivateSubj'])); $deactivateBody = stripcslashes($row['deactivateBody'])); echo "<div class=\"alert\" style=\"border:1px solid #000;border-radius:5px;padding:12px;\">"; echo $alertID."<br />"; echo $alertName."<br />"; echo $alertMessage."<br />"; echo $activateSubj."<br />"; echo $activateBody."<br />"; echo $deactivateSubj."<br />"; echo $deactivateBody."<br />"; echo "</div>"; } Still giving me a blank screen. I don't understand why no parse errors or anything will pop up like they usually do. It's giving me a rough time debugging my scripts. Anyway, the stripcslashes() are there because I had to strip the \ from when I escaped the string when inputting it into the database with real_escape_string(). Quote Link to comment Share on other sites More sharing options...
Tenaciousmug Posted January 8, 2012 Author Share Posted January 8, 2012 Nevermind, PHP changed their way of showing errors. I'm looking at the error_log file. I should have been doing this the whole time. I just didn't know they didn't display them right in the browser anymore. Thanks! I was adding an extra ")" onto the variables I was creating in the while loop. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 8, 2012 Share Posted January 8, 2012 Anyway, the stripcslashes() are there because I had to strip the \ from when I escaped the string when inputting it into the database with real_escape_string(). Um, no. mysql_real_escape_string() will add slashes to certain characters to prevent them from being interpreted as non-data characters. but, the actual content that is stored in the database is the content as it existed before mysql_real_escape_string(). Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 8, 2012 Share Posted January 8, 2012 Nevermind, PHP changed their way of showing errors. I'm looking at the error_log file. I should have been doing this the whole time. I just didn't know they didn't display them right in the browser anymore. Thanks! I was adding an extra ")" onto the variables I was creating in the while loop. PHP displays errors however its configured to display them in the php.ini file. And if you have escaping slashes being stored with your data, something is wrong with the way the data is being inserted to begin with. Quote Link to comment 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.