tarik321 Posted March 10, 2008 Share Posted March 10, 2008 Hi i was wondering if anyone could help me on this problem. I am designing an helpdesk system and there are bascially 3 bits to it, i am designing in PHP, mySQL 1) Client fills in an online form after logging in and submits it (so save to the database) where it will be displayed on another page. 2) An technical user would then open this query up after he logs in, looks at the query and then add his/her comments to the problem, and this is then UPDATED in the database. 3) I have included error messaging, so if the technical analyst has not filled in an certain field then he/she would not be able to update the query as they would be prompted by an error message to do so first. I hope this is okay so far. Im having a problem showing these error messages, when i click the submit button, it will not show an error messages, it just goes to a blank white screen showing the following message - Unable to perform query: select * from form where formID = You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 This is my error message code, i have all the basic aspects of this, but the program is not working. if($prioritylevel == "Please Select") { $message1 = "Please select the issue topic"; header("Location: analystformedit.php?message1=$message1"); exit(); } else if($status == "Please Select") { $message2 = "Please enter the system affected"; header("Location: analystformedit.php?message2=$message2"); exit(); } else if($supportcomments == "") { $message3 = "Please enter details of the problem"; header("Location: analystformedit.php?message3=$message3"); exit(); } Thanks Quote Link to comment Share on other sites More sharing options...
matto Posted March 10, 2008 Share Posted March 10, 2008 you are going to have to post more code - your sql statment has an error in it. The code you have posted is the form checking code and not where the query is taking place.... Quote Link to comment Share on other sites More sharing options...
tarik321 Posted March 10, 2008 Author Share Posted March 10, 2008 This is whole form checking code - <?php require "connect.php"; $formID = $_GET['formID']; $issuetitle = $_GET['issuetitle']; $datesubmitted = $_GET['datesubmitted']; $timesubmitted = $_GET['timesubmitted']; $systemaffected = $_GET['systemaffected']; $prioritylevel = $_GET['prioritylevel']; $issuedetails = $_GET['issuedetails']; $supportcomments = $_GET['supportcomments']; $clientFname = $_GET['clientFname']; $clientSurname = $_GET['clientSurname']; $teamname = $_GET['teamname']; $clientID = $_GET['clientID']; $status = $_GET['status']; $dateactioned = $_GET['dateactioned']; $timeactioned = $_GET['timeactioned']; $analystFname = $_GET['analystFname']; $analystSname = $_GET['analystSname']; if($prioritylevel == "Please Select") { $message1 = "Please select the issue topic"; header("Location: analystformedit.php?message1=$message1"); exit(); } else if($status == "Please Select") { $message2 = "Please enter the system affected"; header("Location: analystformedit.php?message2=$message2"); exit(); } else if($supportcomments == "") { $message3 = "Please enter details of the problem"; header("Location: analystformedit.php?message3=$message3"); exit(); } else { $query = "update form set issuetitle ='".$issuetitle."', datesubmitted ='".$datesubmitted."', timesubmitted ='".$timesubmitted."', systemaffected ='". $systemaffected."', prioritylevel ='".$prioritylevel."', issuedetails ='".$issuedetails."', supportcomments ='".$supportcomments."', clientFname ='".$clientFname."', clientSurname ='".$clientSurname."', teamname ='".$teamname."', clientID ='".$clientID."', status ='".$status."', dateactioned = '".$dateactioned."', timeactioned = '". $timeactioned."', analystFname = '".$analystFname."', analystSname = '".$analystSname."' where formID =".$formID; $result = mysql_query($query, $connection) or die ("Unable to perform query<br>$query"); header("Location: enquiryscreen.php?var=formID"); exit(); } ?> And in the screen i place the error messages, would display the code by the following code - <?php if(isset($_GET['message1'])) { echo $_GET['message1']; } ?> Is this enough ? Thanks Quote Link to comment Share on other sites More sharing options...
tarik321 Posted March 10, 2008 Author Share Posted March 10, 2008 Sorry, and in the form where i would display the details filled in by the client, i have this sql statement. <?php require "connect.php"; $formID = $_GET['formID']; $query = "select * from form where formID = ".$formID; $result = mysql_query($query, $connection) or die ("Unable to perform query: $query<p>".mysql_error()); $row= mysql_fetch_array($result); ?> Quote Link to comment Share on other sites More sharing options...
tarik321 Posted March 10, 2008 Author Share Posted March 10, 2008 Would anyone have an idea on wot the problem could be. Thanks Quote Link to comment Share on other sites More sharing options...
matto Posted March 10, 2008 Share Posted March 10, 2008 Ok. Firstly you may want to change this line $query = "select * from form where formID = ".$formID; to this $query = "select * from form where formID = '$formID'"; I take it you are also checking to see if $_GET['message2'] & $_GET['message3'] are set ? 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.