Jump to content


Photo

Can anyone see the problem? i can't...


  • Please log in to reply
3 replies to this topic

#1 my_r31_baby

my_r31_baby
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 03 August 2006 - 08:09 AM

I'm getting blank pages back. I cant find the php syntax error... Help please...


<?php
include("../db.php");
session_start();
$u_pk = $_SESSION['u_pk'];
$id = $_GET['id'];

if (!session_is_registered('u_pk')) {
// Redirect to login page
echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL='../index.php'>";
} else {



$query = "SELECT * FROM personal_phonebooks WHERE ppb_owner='4' AND ppb_category='3'";



$result = mysql_query($query);
$num = mysql_num_rows($result);
?>



<body bgcolor="#FFFFCC">

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../css/pee_yellow.css" rel="stylesheet" type="text/css">
</head>


<table width="100%" border="1" bgcolor="#FFFFFF">
  <tr bgcolor='#66CCFF'>
    <td><strong>First Name</strong></td>
    <td><strong>Lastname</strong></td>
    <td><strong>Home Phone</strong></td>
    <td><strong>Email Address</strong></td>
  </tr>
<?
while ($row = mysql_fetch_assoc($result)) {
$id = $row['ppb_id'];
$fname = $row['ppb_firstname'];
$lname = $row['ppb_lastname'];
$emailaddress = $row['ppb_emailaddress'];
$homephone = $row['ppb_homephone'];
?>
  <tr>
    <td>id</a></td>
    <td>lname</td>
    <td>homephone</td>
    <td>emailaddress</td>
  </tr>
<?
};
?>
</table>
</body>


<?
mysql_free_result($result);    # Free's mysql
echo "<br>";
echo "<br>";
echo "$num records found...";
?>
<p align="center"><a href="search.php" target="_self">New Search</a></p>
</html>

#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 08:29 AM

try  putting all of your sql in one spot then echo it later on in the page

<?php
session_start();
include("../db.php");  
$u_pk = $_SESSION['u_pk'];
$id = $_GET['id'];

if (!session_is_registered('u_pk')) {
   // Redirect to login page
   echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL='../index.php'>";
} else {
   $query = "SELECT * FROM personal_phonebooks WHERE ppb_owner='4' AND ppb_category='3'";

   $result = mysql_query($query);
   $num = mysql_num_rows($result);

   while ($row = mysql_fetch_assoc($result)) {
    $table = '<tr>
                     <td>' . $row['whatever'] . '</td>
                     <td>' . $row['whatever2'] . '</td>
                <tr>';
   //continue this for all of your fields
   }
   mysql_free_result($result);
}
?>

Now in your html try this

<?php echo "$table"; ?>

Hope this helps



Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 my_r31_baby

my_r31_baby
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 03 August 2006 - 08:56 AM

cheers dude much appreciated


#4 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 03 August 2006 - 09:01 AM

You need to call the session_start before anything else. See the revised version

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users