my_r31_baby Posted August 3, 2006 Share Posted August 3, 2006 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> Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 3, 2006 Share Posted August 3, 2006 try putting all of your sql in one spot then echo it later on in the page [code=php:0]<?phpsession_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 Quote Link to comment Share on other sites More sharing options...
my_r31_baby Posted August 3, 2006 Author Share Posted August 3, 2006 cheers dude much appreciated Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 3, 2006 Share Posted August 3, 2006 You need to call the session_start before anything else. See the revised version Quote Link to comment 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.