cmaclennan Posted October 13, 2009 Share Posted October 13, 2009 Hey All, hoping I just need another set of eyes, but I have a search form that once submitted is supposed to return the values from a MySQL database, but i am getting nothing showing and no errors of any kind. Any Help is appreciated. <?php # Script 8.6.2 - order_search_field.php include ('style.htm'); $page_title = 'Find Ticket'; // Page header. echo '<div id="title">Find Ticket</div>'; // Check if the form has been submitted. if (isset($_GET['submitted'])) { $se = $_REQUEST['search'] ; // Register the user in the database. require_once ('mysql_connect.php'); // Connect to the db. // Make the query. $query = "SELECT * FROM tickets WHERE ticket_id LIKE '$se' OR company LIKE '$se'"; $result = @mysql_query ($query); // Run the query. if ($result) { // If it ran OK. // Print a message. echo '<br>Your entry has been found.</br><br/>'; while ($row = mysql_fetch_array($result)){ echo '<table width="650px" border="0" cellspacing="5" cellpadding="0"> <tr> <td colspan="4"><img src="images/powerlogo.gif" width="300" height="39" alt="PowerCart" /></td> </tr> <tr> <td colspan="4"></td> </tr> <tr> <td colspan="2"><strong>Ticket Details</strong></td> <td>Ticket Id: </td> <td>'; echo $row['ticket_id']; echo '</td> </tr> <tr> <td>Opened By:</td> <td>'; echo $row['name']; echo '</td> <td>Date:</td> <td>'; echo $row['date']; echo '</td> </tr> <tr> <td>Email:</td> <td>'; echo $row['email']; echo '</td> <td> </td> <td> </td> </tr> <tr> <td>Contact:</td> <td>'; echo $row['contact']; echo '</td> <td>Contact Email:</td> <td>'; echo $row['c_email']; echo '</td> </tr> <tr> <td>Phone:</td> <td>'; echo $row['phone']; echo '</td> <td>Ext:</td> <td>'; echo $row['ext']; echo '</td> </tr> <tr> <td>Store ID:</td> <td>'; echo $row['store_id']; echo '</td> <td> </td> <td> </td> </tr> <tr> <td>Address:</td> <td colspan="3">'; echo $row['address']; echo '</td> </tr> <tr> <td colspan="4"> </td> </tr> <tr> <td>Ticket Status:</td> <td>'; echo $row['status']; echo '</td> <td> </td> <td> </td> </tr> <tr> <td>Priority:</td> <td>'; echo $row['priority']; echo '</td> <td>Under Warranty:</td> <td>'; echo $row['warranty']; echo '</td> </tr> <tr> <td>Cart Serial:</td> <td>'; echo $row['serial']; echo '</td> <td>Original ship Date:</td> <td>'; echo $row['o_date']; echo '</td> </tr> <tr> <td>Issue:</td> <td>'; echo $row['issue']; echo '</td> <td>Technician Sent:</td> <td>'; echo $row['tech']; echo '</td> </tr> <tr> <td colspan="4"> </td> </tr> <tr> <td>Notes/Details:</td> <td colspan="3">'; echo $row['notes']; echo '</td> </tr> </table>'; } // Include the footer and quit the script (to not show the form). exit(); } else { // If it did not run OK. echo '<h1 id="mainhead">System Error</h1> <p class="error">Your entry could not be found due to a system error. We apologize for any inconvenience. Please advise the System Administrator</p>'; // Public message. echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message. exit(); } mysql_close(); // Close the database connection. } ?> Link to comment https://forums.phpfreaks.com/topic/177536-solved-form-returning-empty-but-no-errors/ Share on other sites More sharing options...
Alt_F4 Posted October 13, 2009 Share Posted October 13, 2009 can i just ask where you are setting $_GET['submitted']?? Link to comment https://forums.phpfreaks.com/topic/177536-solved-form-returning-empty-but-no-errors/#findComment-936112 Share on other sites More sharing options...
johnsmith153 Posted October 13, 2009 Share Posted October 13, 2009 Is $_GET['submitted'] set? change: if (isset($_GET['submitted'])) { to: if (isset($_GET['submitted'])) { echo "yes it is";exit; to see if it is (then remove the extra bit) Good to know what you do get from running the script. Anything shown on screen at all? Link to comment https://forums.phpfreaks.com/topic/177536-solved-form-returning-empty-but-no-errors/#findComment-936115 Share on other sites More sharing options...
mikesta707 Posted October 13, 2009 Share Posted October 13, 2009 do you know what the @ symbol does? $result = @mysql_query ($query); // Run the query it suppresses errors, so that is probably why you aren't getting an error. plus, you should do this $result = mysql_query ($query) or die(mysql_error()); // Run the query to see what errors mysql might be spitting back at you. It seems like your query is failing Link to comment https://forums.phpfreaks.com/topic/177536-solved-form-returning-empty-but-no-errors/#findComment-936116 Share on other sites More sharing options...
cmaclennan Posted October 13, 2009 Author Share Posted October 13, 2009 Thanks Guys, I got it figured out now thanks a lot. Link to comment https://forums.phpfreaks.com/topic/177536-solved-form-returning-empty-but-no-errors/#findComment-936117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.