Russia Posted August 26, 2009 Share Posted August 26, 2009 I am currently getting a blank page, and no errors are showing up. <?php //The script must connect to DB FIRST! require("../inc/config.php"); $result = mysql_query("select count(*) as rowcount from notes"); $Count = mysql_result($result, 0); echo "<div style=\"text-align:right\">Number of Members: $Count</div>"; if (isset($_POST['del'])) { if(isset($_POST['delchk'])) { for($count=0;$count<count($_POST['delchk']);$count++) { $delete = $_POST['delchk'][$count]; $query = "DELETE FROM `persons` WHERE id = '$delete'"; $result = mysql_query($query); if (!$result) { die("Error deleting persons! Query: $query<br />Error: ".mysql_error()); } } } else { echo "delchk post variable not set"; } } else { echo "del post variable not set"; } $result = mysql_query("SELECT * FROM persons"); // Check how many rows it found if(mysql_num_rows($result) > 0) { echo "<table id=\"mytable\"> <thead> <tr> <th align=\"center\" scope=\"col\">Delete</th> <th align=\"center\" scope=\"col\">First Name</th> <th align=\"center\" scope=\"col\">Last Name</th> <th align=\"center\" scope=\"col\">Profile</th> <th align=\"center\" scope=\"col\">Date of Entry</th> <th align=\"center\" scope=\"col\">IP Address</th> </tr> </thead> <tbody>"; echo "<form name = 'myform' action='' method='post'>"; while($row = mysql_fetch_array($result)) { echo "<tr align=\"center\">"; echo'<td><inputtype=\"checkbox\"id=\"delchk\"name=\"delchk[]\"value=\"$row['id']\"/></td>'; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td><a target=frame2 href='" ."profile.php?user1=". $row['FirstName'] ."'>Check HighScores</a></td>"; echo "<td>" . $row['AddedDate'] . "</td>"; echo "<td>" . $row['Ip'] . "</td>"; echo "</tr>"; } echo "</tbody>"; echo "</table>"; echo "<hr>"; echo "<input type='submit' name = 'del' value='Delete Selected'></form>"; echo "<input type='button' onclick='checkall(document.myform.delchk);' value='Select All'>"; echo "<input type='button' onclick='uncheckall(document.myform.delchk);' value='UnSelect All'>"; } else { // No rows were found ... echo " <table id=\"mytable\"> <thead> <tr> <th align=\"center\" scope=\"col\">Delete</th> <th align=\"center\" scope=\"col\">First Name</th> <th align=\"center\" scope=\"col\">Last Name</th> <th align=\"center\" scope=\"col\">Profile</th> <th align=\"center\" scope=\"col\">Date of Entry</th> <th align=\"center\" scope=\"col\">IP Address</th> </tr> </thead> <tbody>"; echo "</tbody>"; echo "</table>"; } mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/ Share on other sites More sharing options...
Maq Posted August 26, 2009 Share Posted August 26, 2009 Before examining your code, turn error_reporting on by placing the following lines directly after your opening <?php tag: ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-906995 Share on other sites More sharing options...
Russia Posted August 26, 2009 Author Share Posted August 26, 2009 Done: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); //The script must connect to DB FIRST! require("../inc/config.php"); $result = mysql_query("select count(*) as rowcount from notes"); $Count = mysql_result($result, 0); echo "<div style=\"text-align:right\">Number of Members: $Count</div>"; if (isset($_POST['del'])) { if(isset($_POST['delchk'])) { for($count=0;$count<count($_POST['delchk']);$count++) { $delete = $_POST['delchk'][$count]; $query = "DELETE FROM `persons` WHERE id = '$delete'"; $result = mysql_query($query); if (!$result) { die("Error deleting persons! Query: $query<br />Error: ".mysql_error()); } } } else { echo "delchk post variable not set"; } } else { echo "del post variable not set"; } $result = mysql_query("SELECT * FROM persons") or die("error retrieving persons".mysql_error()); // Check how many rows it found if(mysql_num_rows($result) > 0) { echo "<table id=\"mytable\"> <thead> <tr> <th align=\"center\" scope=\"col\">Delete</th> <th align=\"center\" scope=\"col\">First Name</th> <th align=\"center\" scope=\"col\">Last Name</th> <th align=\"center\" scope=\"col\">Profile</th> <th align=\"center\" scope=\"col\">Date of Entry</th> <th align=\"center\" scope=\"col\">IP Address</th> </tr> </thead> <tbody>"; echo "<form name = 'myform' action='' method='post'>"; while($row = mysql_fetch_array($result)) { echo "<tr align=\"center\">"; echo'<td><inputtype=\"checkbox\"id=\"delchk\"name=\"delchk[]\"value=\"$row['id']\"/></td>'; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td><a target=frame2 href='" ."profile.php?user1=". $row['FirstName'] ."'>Check HighScores</a></td>"; echo "<td>" . $row['AddedDate'] . "</td>"; echo "<td>" . $row['Ip'] . "</td>"; echo "</tr>"; } echo "</tbody>"; echo "</table>"; echo "<hr>"; echo "<input type='submit' name = 'del' value='Delete Selected'></form>"; echo "<input type='button' onclick='checkall(document.myform.delchk);' value='Select All'>"; echo "<input type='button' onclick='uncheckall(document.myform.delchk);' value='UnSelect All'>"; } else { // No rows were found ... echo " <table id=\"mytable\"> <thead> <tr> <th align=\"center\" scope=\"col\">Delete</th> <th align=\"center\" scope=\"col\">First Name</th> <th align=\"center\" scope=\"col\">Last Name</th> <th align=\"center\" scope=\"col\">Profile</th> <th align=\"center\" scope=\"col\">Date of Entry</th> <th align=\"center\" scope=\"col\">IP Address</th> </tr> </thead> <tbody>"; echo "</tbody>"; echo "</table>"; } mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-906997 Share on other sites More sharing options...
ignace Posted August 26, 2009 Share Posted August 26, 2009 $result = mysql_query($query); if (!$result) only tells you the query did not contain any errors. To make sure the query did actually something use: $result = mysql_query($query); if ($result && mysql_affected_rows($result)) Make sure the query was successfull (you need it otherwise the latter will throw an error if didn't) and second make sure it did something (update a table, delete a record, ..) Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907002 Share on other sites More sharing options...
Russia Posted August 26, 2009 Author Share Posted August 26, 2009 That seemed to no work either. Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907010 Share on other sites More sharing options...
Russia Posted August 26, 2009 Author Share Posted August 26, 2009 Any luck figuring out the problem. Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907017 Share on other sites More sharing options...
PFMaBiSmAd Posted August 26, 2009 Share Posted August 26, 2009 The posted code (the last version posted) contains a fatal parse error - Parse error: parse error, expecting `','' or `';'' in your_file.php on line 59 Please, please, please learn php, develop php code, and debug php code on a system with error_reporting set to E_ALL and display_errors set to ON in your php.ini to get php to help you. Fatal parse errors prevent your code from executing and trying to set those two values in your code won't do anything for a parse error because the code is never executed to set the values. Stop and start your web server to get any change made to php.ini and confirm the actual values using a phpinfo(); statement. Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907020 Share on other sites More sharing options...
Russia Posted August 26, 2009 Author Share Posted August 26, 2009 So you do not know how to fix it? Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907031 Share on other sites More sharing options...
ignace Posted August 26, 2009 Share Posted August 26, 2009 Sure he does: Please, please, please learn php Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907039 Share on other sites More sharing options...
Maq Posted August 26, 2009 Share Posted August 26, 2009 echo''; Why did you decide to format this string differently, well ultimately incorrectly? You have to learn how to concatenate and format strings properly. Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907058 Share on other sites More sharing options...
PFMaBiSmAd Posted August 26, 2009 Share Posted August 26, 2009 The solution involves changing two single-quotes into double-quotes and a pair of {} around a php variable. Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907065 Share on other sites More sharing options...
Russia Posted August 26, 2009 Author Share Posted August 26, 2009 Where do I change those things. I have been trying for about 4 hours. And didnt get anywhere. Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907067 Share on other sites More sharing options...
Maq Posted August 26, 2009 Share Posted August 26, 2009 Where do I change those things. I have been trying for about 4 hours. And didnt get anywhere. Reply 9 & 10. Quote Link to comment https://forums.phpfreaks.com/topic/172011-blank-page/#findComment-907086 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.