RaythMistwalker Posted January 3, 2010 Share Posted January 3, 2010 <?php //Start session session_start(); ini_set('display_errors', 'on'); error_reporting(E_ALL); //Include database connection details require_once('../config.php'); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Set Action $action = $_GET['action']; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(b6_3883123_arcade); if(!$db) { die("Unable to select database"); } //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } ?> <?php if ($action = 'players') { echo "<center><h2><b>Member List</b></h2></center>"; echo "<table border="1" cellspacing="2" cellpadding="2" class='tableborder'>"; echo "<tr> "; echo "<th><font face="Arial, Helvetica, sans-serif">Player ID</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Login</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Password</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Email</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">IP</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Avatar</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Group</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Skin</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Settings</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Tournaments</font></th>"; echo "</tr>"; $qry="SELECT * FROM phpqa_accounts"; $result=mysql_query($qry) or trigger_error('Query error! Query: <pre>'.$qry.'</pre>Reason: ' . mysql_error()); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $name=mysql_result($result,$i,"name"); $pass=mysql_result($result,$i,"pass"); $email=mysql_result($result,$i,"email"); $ipaddress=mysql_result($result,$1,"ipaddress"); $avatar=mysql_result($result,$i,"avatar"); $group=mysql_result($result,$i,"group"); $skin=mysql_result($result,$i,"skin"); $settings=mysql_result($result,$i,"settings"); $tournaments=mysql_result($result,$i,"tournaments"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><? echo "$id" ;?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$name" ;?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$pass" ;?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$email"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$ipaddress"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$avatar"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$group"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$skin"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$settings"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$tournaments"; ?></font></td> </tr> <?php ++$i; } echo "</table>"; } ?> This is literally just turning out a blank page which usually happens with a syntax error but i cant seem to find it. It is meant to access the database, return all info a present in a table if the url is website.com/arcadeadmin.php?action=players Quote Link to comment https://forums.phpfreaks.com/topic/187059-admin-page-help/ Share on other sites More sharing options...
premiso Posted January 4, 2010 Share Posted January 4, 2010 One item: if ($action = 'players') { is incorrect as that is the assignment operator. You want the comparison: if ($action == 'players') { As for the error, you get the syntax error after you turned on the error display or not? If not put it above the session_start call. Also make sure that your <?php is at the very top of the page and no spaces before it, as it will cause an issue with session_start. If you do receive the error, please post it and highlight the line it is occurring on. Quote Link to comment https://forums.phpfreaks.com/topic/187059-admin-page-help/#findComment-987847 Share on other sites More sharing options...
RaythMistwalker Posted January 4, 2010 Author Share Posted January 4, 2010 absolutely no error after doing what you said. it is definitely the action part cos i tested without action and it worked fine Quote Link to comment https://forums.phpfreaks.com/topic/187059-admin-page-help/#findComment-987856 Share on other sites More sharing options...
PFMaBiSmAd Posted January 4, 2010 Share Posted January 4, 2010 Fatal parse errors are not displayed unless the error_reporting/display_errors settings are in effect before your script is parsed. When they are set in your script they only display runtime errors, warnings, and notices. Your script has the following fatal parse errors - Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in .... because of double-quotes contained within a double-quoted string in all the following lines of code - echo "<table border="1" cellspacing="2" cellpadding="2" class='tableborder'>"; echo "<th><font face="Arial, Helvetica, sans-serif">Player ID</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Login</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Password</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Email</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">IP</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Avatar</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Group</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Skin</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Settings</font></th>"; echo "<th><font face="Arial, Helvetica, sans-serif">Tournaments</font></th>"; You also have a typo in the following line (the $1 should be $i) - $ipaddress=mysql_result($result,$1,"ipaddress"); Quote Link to comment https://forums.phpfreaks.com/topic/187059-admin-page-help/#findComment-987860 Share on other sites More sharing options...
RaythMistwalker Posted January 4, 2010 Author Share Posted January 4, 2010 fixed the $1 to $i what do i do about the double "? Quote Link to comment https://forums.phpfreaks.com/topic/187059-admin-page-help/#findComment-987862 Share on other sites More sharing options...
PFMaBiSmAd Posted January 4, 2010 Share Posted January 4, 2010 Either escape them with \ or change them to single-quotes. Quote Link to comment https://forums.phpfreaks.com/topic/187059-admin-page-help/#findComment-987864 Share on other sites More sharing options...
RaythMistwalker Posted January 4, 2010 Author Share Posted January 4, 2010 thanks got it working now Quote Link to comment https://forums.phpfreaks.com/topic/187059-admin-page-help/#findComment-987865 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.