Jump to content

Get Method Problems


topflight

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.