By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,462 Members | 3,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,462 IT Pros & Developers. It's quick & easy.

Using echo for a table produces blank page, not even errors!!!?

P: 2
Hi, I have a hyperlink which goes to the page below and passes the PK_ID from a query into 'userid'. From this we query the DB and then echo a table with a form; only the textboxes are already populated with the data from the query (in theory)!!!

But I get a blank page! I have error reporting on php and mysql but nothing is displayed?

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. echo "<form method=\"post\" action=\"\" style=\"padding-left: 10px\">";
  4.  
  5. ini_set('display_errors','On');
  6. error_reporting(E_ALL);
  7.  
  8. $user = $_GET['userid'];
  9.  
  10. include 'config.php';
  11. include 'opendb.php';
  12.  
  13. $query = "select * from users WHERE user_id LIKE '$user'"; 
  14.  
  15. $result = mysql_db_query("servicemgmt", $query . mysql_error());
  16.  
  17. $r = mysql_fetch_array($result);
  18.  
  19. $firstname = $r['user_fname'];
  20. $lastname = $r['user_lname'];
  21. $ext = $r['user_ext'];
  22. $bleep = $r['user_bleep'];
  23. $exttel = $r['user_extno'];
  24. $email = $r['user_email'];
  25.  
  26.  
  27. echo "<table style=\"width: 80%\">";
  28. echo "<tr><td>First Name</td><td><input type=\"text\" value=\"$firstname\" name=\"firstname\" id=\"firstname\" style=\"width: 160px\"/></td><td>Last Name</td><td> <input type=\"text\" value=\"$lastname\" name=\"lastname\" id=\"lastname\" style=\"width: 160px\"/></td></tr>";
  29. echo "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
  30. echo "<tr><td>Extension</td><td> <input type=\"text\" value=\"$ext\" name=\"ext\" id=\"ext\" style=\"width: 160px\"/></td><td>Bleep No.</td><td> <input type=\"text\" value=\"$bleep\" name=\"bleep\" id=\"bleep\" style=\"width: 160px\"/></td></tr>";
  31. echo "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
  32. echo "<tr><td>External Tel.</td><td><input type=\"text\" value=\"$exttel\" name=\"exttel\" id=\"exttel\" style=\"width: 160px\"/></td><td>&nbsp;</td><td>&nbsp;</td></tr>";
  33. echo "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
  34. echo "<tr><td>Email</td><td><input type=\"text\" value=\"$email\" name=\"email\" id=\"email\" style=\"width: 200px\" /></td><td>&nbsp;</td><td>&nbsp;</td></tr>";
  35. echo "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
  36. echo "<tr><td><input name=\"updateuser\" type=\"submit\" id=\"updateuser\" value=\"Update User Details\" /></td><td>&nbsp;</td><td>&nbsp;</td><td><input name=\"reset1\" type=\"reset\" value=\"Clear Form\" /></td></tr>";
  37. echo "</table>";
  38.  
  39. echo "</form>";
  40.  
  41. ?>
Aug 15 '07 #1
Share this Question
Share on Google+
4 Replies


pbmods
Expert 5K+
P: 5,821
Heya, Rawky. Welcome to TSDN!

Try adding this after line 15:
Expand|Select|Wrap|Line Numbers
  1. echo mysql_error();
  2.  
Aug 15 '07 #2

P: 2
Thanks, it's still blank, here's the calling page: -

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2.  
  3. error_reporting(E_ALL);
  4. ini_set('display_errors', '1');
  5.  
  6. include 'config.php';
  7. include 'opendb.php';
  8.  
  9. $edituser = $_POST['edituser'];
  10.  
  11.  
  12. $search = $_POST['edituser'];
  13. if ($search) // perform search only if a string was entered. 
  14. $srch="%".$search."%"; 
  15. $query = "select * from users WHERE user_sname LIKE '$srch'"; 
  16.  
  17. $result = mysql_db_query("servicemgmt", $query . mysql_error());
  18.  
  19. if ($result) 
  20. echo "Names matching query: -<br><br>";
  21. echo "<table width=90% align=left border=0>";
  22. while ($r = mysql_fetch_array($result)) { 
  23. $sn = $r["user_sname"];
  24. $fn = $r["user_fname"];
  25. $id = $r["user_id"]; 
  26. echo "<tr><td width=\"100%\"><a href=\"editSearcheduser.php?userid=$id\">$sn $fn</a></td></tr>";
  27. //echo "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>"; 
  28. }
  29. echo "</table>"; 
  30. } else { echo "problems...."; } 
  31. } else { 
  32. echo "Search string is empty. <br> Go back and type a string to search"; 
  33. }
  34.  
  35. include 'closedb.php';
  36.  
  37. ?>
Aug 15 '07 #3

pbmods
Expert 5K+
P: 5,821
Heya, Rawky.

This line confuses me:
Expand|Select|Wrap|Line Numbers
  1. $result = mysql_db_query("servicemgmt", $query . mysql_error());
  2.  
I don't understand why you are appending the result of mysql_error() to $query.
Aug 15 '07 #4

Purple
Expert 100+
P: 404
Hi,

try doing :

[PHP]echo $query;[/PHP]

and copying the query and running it directly in whatever database gui you have installed..

Let us know if that works ok cause we are then back to the code..

Regards Purple
Aug 15 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.