nowuseeme Posted July 16, 2013 Share Posted July 16, 2013 hey guys, anyone have any idea why i cant get my code to show the results when i click submit? thanks. <?php require("db.php"); $data = array(); if(!empty($_GET['term'])) { $query = "SELECT department, subject, message FROM supporttickets WHERE ticketnumber = ?"; $stmt = $db->prepare($query); $stmt->execute(array($_GET['term'])); $data = $stmt->fetchAll(); } foreach ($data as $row) { echo htmlspecialchars($row['department']); } if (!$data) { echo "Please enter valid Ticket Number."; } Quote Link to comment Share on other sites More sharing options...
fastsol Posted July 16, 2013 Share Posted July 16, 2013 Do you have error reporting turned on? What do you get if you do a print_r($data); Are you sure the query isn't failing? Quote Link to comment Share on other sites More sharing options...
nowuseeme Posted July 16, 2013 Author Share Posted July 16, 2013 (edited) Do you have error reporting turned on? What do you get if you do a print_r($data); Are you sure the query isn't failing? Hi i have error reporting on im not getting any errors at all, for print_r($data); im also not getting anything the only thing that is showing is (Please enter valid Ticket Number.) and that is showing all the time thanks. Edited July 16, 2013 by nowuseeme Quote Link to comment Share on other sites More sharing options...
fastsol Posted July 16, 2013 Share Posted July 16, 2013 Ok well then you're not getting any results from the query or the query is failing. You need to start diagnosing that part first. Quote Link to comment Share on other sites More sharing options...
nowuseeme Posted July 16, 2013 Author Share Posted July 16, 2013 Ok well then you're not getting any results from the query or the query is failing. You need to start diagnosing that part first. Ok so i changed the $_GET TO $_POST and now it's working does that seem right? Quote Link to comment Share on other sites More sharing options...
fastsol Posted July 16, 2013 Share Posted July 16, 2013 No idea, you didn't show us how you were getting the value of ['term'] to the page in the first place. So $_POST could be correct if you're using a form to send that data and the form method is set to "post". Quote Link to comment Share on other sites More sharing options...
Solution nowuseeme Posted July 16, 2013 Author Solution Share Posted July 16, 2013 Ok got it thanks for the help! 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.