Jump to content

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


my_r31_baby

Recommended Posts

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>
Link to comment
Share on other sites

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

[code=php:0]
<?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);
}
?>[/code]

Now in your html try this

[code=php:0]<?php echo "$table"; ?>[/code]

Hope this helps


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.