rawky1976 Posted August 15, 2007 Share Posted August 15, 2007 Me again, sorry dudes. I know you tied to help last night and I've tried books and other forums before bothering you again. But it's still blank man! Since last night I tried putting the form tags inside the php as well as the table. I've tried single quotes and escaping. No hair left man, help me!!! Here's my code, I think it's the echo's: - <?php echo "<form method=\"post\" action=\"\" style=\"padding-left: 10px\">"; ini_set('display_errors','On'); error_reporting(E_ALL); $user = $_GET['userid']; include 'config.php'; include 'opendb.php'; $query = "select * from users WHERE user_id LIKE '$user'"; $result = mysql_db_query("servicemgmt", $query . mysql_error()); $r = mysql_fetch_array($result); $firstname = $r['user_fname']; $lastname = $r['user_lname']; $ext = $r['user_ext']; $bleep = $r['user_bleep']; $exttel = $r['user_extno']; $email = $r['user_email']; echo "<table style=\"width: 80%\">"; 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>"; echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>"; 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>"; echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>"; echo "<tr><td>External Tel.</td><td><input type=\"text\" value=\"$exttel\" name=\"exttel\" id=\"exttel\" style=\"width: 160px\"/></td><td> </td><td> </td></tr>"; echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>"; echo "<tr><td>Email</td><td><input type=\"text\" value=\"$email\" name=\"email\" id=\"email\" style=\"width: 200px\" /></td><td> </td><td> </td></tr>"; echo "<tr><td> </td><td> </td><td> </td><td> </td></tr>"; echo "<tr><td><input name=\"updateuser\" type=\"submit\" id=\"updateuser\" value=\"Update User Details\" /></td><td> </td><td> </td><td><input name=\"reset1\" type=\"reset\" value=\"Clear Form\" /></td></tr>"; echo "</table>"; echo "</form>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/ Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 Here's the page that calls it: - <?php error_reporting(E_ALL); ini_set('display_errors', '1'); include 'config.php'; include 'opendb.php'; $edituser = $_POST['edituser']; $search = $_POST['edituser']; if ($search) // perform search only if a string was entered. { $srch="%".$search."%"; $query = "select * from users WHERE user_sname LIKE '$srch'"; $result = mysql_db_query("servicemgmt", $query . mysql_error()); if ($result) { echo "Names matching query: -<br><br>"; echo "<table width=90% align=left border=0>"; while ($r = mysql_fetch_array($result)) { $sn = $r["user_sname"]; $fn = $r["user_fname"]; $id = $r["user_id"]; echo "<tr><td width=\"100%\"><a href=\"editSearcheduser.php?userid=$id\">$sn $fn</a></td></tr>"; //echo "<tr><td> </td><td> </td></tr>"; } echo "</table>"; } else { echo "problems...."; } } else { echo "Search string is empty. <br> Go back and type a string to search"; } include 'closedb.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325096 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 Try to change $result = mysql_db_query("servicemgmt", $query . mysql_error()); to $result = mysql_db_query("servicemgmt", $query); I don't know why you'd put the last error after the query... Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325100 Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 Been troubleshooting by removing bits, got down to: - <?php //$user = $_GET['userid']; //echo $user; ?> Even if I uncomment the above the page is blank! So it must be to do with what's being passed and how? In the URL it says ......php?userid=4 Is that OK? Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325111 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 You probably got some error. Try change ini_set('display_errors', '1'); to ini_set('display_errors', E_ALL); and see if there are any. Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325118 Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 And if I add echo 'hello'; then this displays too, is it trying to read a single value into an array and can you do that? Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325125 Share on other sites More sharing options...
plutomed Posted August 15, 2007 Share Posted August 15, 2007 Have you tried to use mysql_query instead of mysql_db_query? Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325126 Share on other sites More sharing options...
lemmin Posted August 15, 2007 Share Posted August 15, 2007 print_r($_GET); see if the variables are in the array. Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325127 Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 Can't really print_r($_GET); because if I uncomment //$user = $_GET['userid']; it's blank page! I'm pasting in one line at a time to see where problem is. Must be with passed data is the calling page OK: - <?php error_reporting(E_ALL); ini_set('display_errors', '1'); include 'config.php'; include 'opendb.php'; $edituser = $_POST['edituser']; $search = $_POST['edituser']; if ($search) // perform search only if a string was entered. { $srch="%".$search."%"; $query = "select * from users WHERE user_sname LIKE '$srch'"; $result = mysql_db_query("servicemgmt", $query . mysql_error()); if ($result) { echo "Names matching query: -<br><br>"; echo "<table width=90% align=left border=0>"; while ($r = mysql_fetch_array($result)) { $sn = $r["user_sname"]; $fn = $r["user_fname"]; $id = $r["user_id"]; echo "<tr><td width=\"100%\"><a href=\"editSearcheduser.php?userid=$id\">$sn $fn</a></td></tr>"; //echo "<tr><td> </td><td> </td></tr>"; } echo "</table>"; } else { echo "problems...."; } } else { echo "Search string is empty. <br> Go back and type a string to search"; } include 'closedb.php'; ?> Specifically the link? <a href=\"editSearcheduser.php?userid=$id\"> Thanks, MArk Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325135 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 You probably got some error. Try change ini_set('display_errors', '1'); to ini_set('display_errors', E_ALL); and see if there are any. Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325145 Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 OK if I have: - <?php ini_set('display_errors', E_ALL); include 'config.php'; include 'opendb.php'; //$user = $_GET['userid']; $query = "select * from users WHERE user_id LIKE '$user'"; $result = mysql_db_query("servicemgmt", $query . mysql_error()); $r = mysql_fetch_array($result); ?> Then I get undefined variable 'userid', but if I uncomment the commented line then I get the blank page. So what is being passed in the URL from the calling page and can it be passed into a $_GET? It's just the number 4? Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325149 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 If you get "undefined variable 'userid'" then perhaps you have a typo URL or something. You haven't given any GET value with the name 'userid' at least. Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325150 Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 Yes I just found this: - The $_GET Variable The $_GET variable is an array of variable names and values sent by the HTTP GET method. The $_GET variable is used to collect values from a form with method="get". I'm not using a form I'm using a hyperlink so POST won't work either, that's what it is? The first page link is: - <a href=\"editSearcheduser.php?userid=$id\">$sn $fn</a> It's not in a form!?!?!? So what should I use to receive the passed data please? Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325159 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 HTTP GET is a "normal" request. It works by using a link too. If you click this link then you'll make an HTTP GET request. Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325163 Share on other sites More sharing options...
akitchin Posted August 15, 2007 Share Posted August 15, 2007 you need to have display_errors on (note that giving it a value of E_ALL won't actually change the reporting level) and the level set to high. undefined variable errors (i assume it was actually an undefined INDEX) are usually notices, not things that will actually cause a script to halt. my guess is that your issue lies with the query section. try this: <?php ini_set('display_errors', TRUE); error_reporting(E_ALL); include 'config.php'; include 'opendb.php'; $user = $_GET['userid']; $query = "select * from users WHERE user_id LIKE '$user'"; $result = mysql_query($query) or die(mysql_error()); $r = mysql_fetch_array($result); ?> if this works, it's a sign that your querying method is flawed. Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325168 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 Duh... stupid me!! I meant to say error_reporting... Bangs head against wall. In fact it already had error reporting to E_ALL. Even more stupid me >_< Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325170 Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 Still the same man, i get undefined unless I uncomment out the line then I get blank page I'm using: - $query = "select * from users WHERE user_id LIKE '$user'"; LIKE is when u get a close match right? What's the keyword for a perfect match? Please post whole line above re-written with it?! Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325174 Share on other sites More sharing options...
willpower Posted August 15, 2007 Share Posted August 15, 2007 I may be missing the point...but you have no form action attached...you need to tell te form where to submit too Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325184 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 I may be missing the point...but you have no form action attached...you need to tell te form where to submit too None or empty action attribute makes it equal the current page. Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325187 Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 In the calling page it's a hyperlink, and you've said that a GET will store the passed data right? So there doesn't need to be a form in the receiving page? It's the //$user = $_GET['userid']; causing the problem, if I uncomment that then it's a blank page. It's called 'userid' on both pages but it's only the PK of the table (say the number 4) can the be read into an array using $_GET['userid']? Aren't I just passing a single number '4', that needs to go into a single variable and not an array? How do you do that? Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325196 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 Try <?php ini_set('display_errors', TRUE); error_reporting(E_ALL); include 'config.php'; include 'opendb.php'; $query = "select * from users WHERE user_id='{$_GET['userid']}'"; $result = mysql_query($query) or die(mysql_error()); var_dump(mysql_num_rows($result)); ?> And see what it says. Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325201 Share on other sites More sharing options...
rawky1976 Posted August 15, 2007 Author Share Posted August 15, 2007 Thanks Daniel, it's blank if u do that. so many suggestions, it must be a machine or php config setup? Quote Link to comment https://forums.phpfreaks.com/topic/65134-its-still-blank/#findComment-325202 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.