topflight Posted October 31, 2008 Share Posted October 31, 2008 After reading Thrope great tutorial I decided I would try to make my own profile page. Well...... Their is only one problem. The Informaiton is not displaying please help thanks roster.php <style type="text/css"> <!-- a:visited { color: #0066FF; } a:hover { color: #006699; } a:active { color: #0066FF; } --> </style></head> <table width="100%" cellpadding="0" cellspacing="0"> <?php include 'db.php'; ?> <?php ini_set('display_errors', 1); error_reporting(E_ALL); $sql = "SELECT * FROM `pilots` ORDER BY `date` DESC LIMIT 7"; $query = mysql_query($sql) or die(mysql_error()); $num = mysql_num_rows($query) or die(mysql_error()); ?> <table width=35% cellpadding="3" align="CENTER"> <tr bgcolor=#EEEEEE> <td width="5%">PID</td> <td width="5%">Name</td> <td width="10%">Hub</td> </tr> <?php if($num>0) { // <---- Bracket ONE opened while ($data = mysql_fetch_assoc($query)) { // <---- Bracket TWO opened ?> <? $pid = $data['login']; ?> <tr bgcolor=#EEEEEE> <tr style="background-color:#EAEAEA;" onmouseover="this.style.backgroundColor='#0099FF'" onmouseout="this.style.backgroundColor='#EAEAEA'"> <td><A HREF="profile.php?login=<? echo "{$data["login"]}"?> ">ASA<? echo"{$data['login']}"?></A></td> <td><?php echo "{$data["fname"]}" , "{$data["lname"]}"?></td> <td><?php echo "{$data["hub"]}"?></td> </tr> <?php } ?> </table> <?php } if($num<0){ echo'<i>No Pilots In Database</i>'; } ?> profile.php <?php if(isset($_GET['login'])){ include 'db.php'; $sql = ("SELECT * FROM 'pilots' WHERE login = '$_GET['login']'"); $query = mysql_query($sql); if($query){ if (mysql_num_rows($query) > 0) { $row = mysql_fetch_assoc($query); ?> <font size="4" color="#0066CC"><center>Pilot Information Card</center></font> <table width="42%" border="0" cellspacing="0" cellpadding="1" align="center"> <tr> <th width="38%" scope="row">Pilot ID</th> <td width="62%"><?php echo "{$data["login"]}"?></td> </tr> <tr> <th scope="row">Pilot Name</th> <td><?php echo "{$data["fname"]}" , "{$data["lname"]}"?></td> </tr> <tr> <th scope="row">Hub</th> <td><?php echo "{$data["hub"]}"?></td> </tr> <tr> <th height="23" scope="row">Rating</th> <td><?php echo "{$data["rating"]}"?></td> </tr> <tr> <th scope="row">Date Hired </th> <td><?php echo "{$data["rating"]}"?></td> </tr> <tr> <th scope="row">Email</th> <td><?php echo "{$data["email"]}"?></td> </tr> </table> <tr><td colspan=2><hr height=1></td></tr> <font size="" color="#0066CC"><center>Captin <? "{$data["lname"]}"?> Latest Flights</center></font> <h6>Comming Soon!</h6> <?php } } } ?> thanks in advanced Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/ Share on other sites More sharing options...
topflight Posted October 31, 2008 Author Share Posted October 31, 2008 Also I am recceving the following error message: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\profile.php on line 4 Line 4 seems ok. Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/#findComment-678948 Share on other sites More sharing options...
topflight Posted October 31, 2008 Author Share Posted October 31, 2008 I have now changed the profile code to: <?php if(isset($_GET['login'])){ include 'db.php'; $sql = ("SELECT * FROM 'pilots' WHERE login = '_GET['login']'"); $query = mysql_query($sql); if($query){ if (mysql_num_rows($query) > 0) { $data = mysql_fetch_assoc($query); ?> <font size="4" color="#0066CC"><center>Pilot Information Card</center></font> <table width="42%" border="0" cellspacing="0" cellpadding="1" align="center"> <tr> <th width="38%" scope="row">Pilot ID</th> <td width="62%"><?php echo "{$data["login"]}"?></td> </tr> <tr> <th scope="row">Pilot Name</th> <td><?php echo "{$data["fname"]}" , "{$data["lname"]}"?></td> </tr> <tr> <th scope="row">Hub</th> <td><?php echo "{$data["hub"]}"?></td> </tr> <tr> <th height="23" scope="row">Rating</th> <td><?php echo "{$data["rating"]}"?></td> </tr> <tr> <th scope="row">Date Hired </th> <td><?php echo "{$data["rating"]}"?></td> </tr> <tr> <th scope="row">Email</th> <td><?php echo "{$data["email"]}"?></td> </tr> </table> <tr><td colspan=2><hr height=1></td></tr> <font size="" color="#0066CC"><center>Captin <?php "{$data["lname"]}"?> Latest Flights</center></font> <h6>Comming Soon!</h6> <?php } } } ?> And nothing is not displaying still not even the tables. Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/#findComment-678952 Share on other sites More sharing options...
DarkWater Posted October 31, 2008 Share Posted October 31, 2008 ....You can't take off the $ and expect the variable to be interpolated. .... .... Anyway, when using an array inside of a string, you need to enclose it in { }. $sql = ("SELECT * FROM 'pilots' WHERE login = '{$_GET['login']}'"); Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/#findComment-678983 Share on other sites More sharing options...
topflight Posted October 31, 2008 Author Share Posted October 31, 2008 Thanks DarkWater! Now I am am just receiving a blank page no errors but just a blank page. please help. Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/#findComment-679070 Share on other sites More sharing options...
topflight Posted October 31, 2008 Author Share Posted October 31, 2008 Does anybody else no why? Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/#findComment-679371 Share on other sites More sharing options...
kenrbnsn Posted October 31, 2008 Share Posted October 31, 2008 Change these statements <?php $sql = ("SELECT * FROM 'pilots' WHERE login = '{$_GET['login']}'"); $query = mysql_query($sql); ?> to <?php $sql = "SELECT * FROM pilots WHERE login = '{$_GET['login']}'"; $query = mysql_query($sql) or die("Problem with the query: $sql<br>" . mysql_error()); ?> and see if anything prints. Ken Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/#findComment-679375 Share on other sites More sharing options...
topflight Posted October 31, 2008 Author Share Posted October 31, 2008 Thanks I will try that.But do you think my code is ok for what I am trying to do. Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/#findComment-679406 Share on other sites More sharing options...
topflight Posted October 31, 2008 Author Share Posted October 31, 2008 thanks not it works. Link to comment https://forums.phpfreaks.com/topic/130815-get-method-problems/#findComment-679709 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.