Doctrcid Posted February 22, 2010 Share Posted February 22, 2010 Hi again,I seem to be having a problem with an update statment in my php code...Mainly, a jobID and a job description has been entered into a table called jobs like thisjobID jobDescription solution timeSpent dateOfCompletion1 bla bla I then have a form that updates the tables solution, timespent and date of completionsolution.php then executes the queries etc but there is something wrong with the highlighted update query...solution.php: <?php//declare variables$jobID = $_POST['jobID'];$solution = $_POST['solution'];$timeSpent = $_POST['timeSpent'];// Connects to Database and MySQL$con = mysql_connect("localhost", "cranfieldL", "chelski01");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("starlink_dfs", $con);[color="#FF0000"][b]mysql_query("UPDATE job SET solution = $solution, timeSpent=$timeSpent, dateOfCompletion = now() WHERE jobID = $jobID");[/b][/color]echo "<h1>Record added</h1>";echo "</hr>";?> any ideas??? need help ASAP Link to comment Share on other sites More sharing options...
Synook Posted February 22, 2010 Share Posted February 22, 2010 You can use mysql_error() to figure out what is wrong with a query. However, in general, you need quotation marks around strings in MySQL queries. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.