Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP-MySQL Update problem

Status
Not open for further replies.

benrob82

Programmer
Jul 28, 2005
116
GB
Hi can anyone see a problem with this. When I try to update the database it does not work have I missed something
?

Code:
$finsql = "UPDATE gh_vacancies SET title = \"$title\", description = \"$description\", keyskills = \"$keyskills\", salary = \"$salary\", type = \"$type\", deadline = \"$year_deadline-$month_deadline-$day_deadline\", company = \"$company_id\", submitted_by = \"$submitted_by\" where id = \"$jobid\""; 
		$insertsql = mysql_query($finsql);
		echo "mysql=$finsql";

and it produces the following statement when I check and I cant see a problem

Code:
mysql=UPDATE gh_vacancies SET title = "Producer1", description = "We are currently looking for an experienced Producer to join us at this exciting time, working on both current and next gen contracts accross all platforms. ", keyskills = "Key Skills: Involvement with at least 2 published games Proven personnel management and scheduling capabilities if you are interested in working with Eutechnyx or have any other enquiries about this vancancy, please send an email to:  ", salary = "", type = "3", deadline = "2006-05-5", company = "Co Limited", submitted_by = "name@email.com" where id = "27"

any ideas
 
thanks for the reply but it isn't producing an error its just not updating. It actually confirms that the update is ok but then doesnt update the table.
 
But one surefireway to check would be to add necessary error trapping to your code. At an absolute minimum in the example you've posted, changing:

$insertsql = mysql_query($finsql);

to read:

$insertsql = mysql_query($finsql) [red]or die (mysql_error());[/red]

would probably be helpful to your debugging efforts.



Want the best answers? Ask the best questions! TANSTAAFL!
 
As an addendum (I posted while you were posting), the code you have posted will not output any errors. You must explicitly code your script to do this.

This becomes particularly important when your code goes from development to production. You don't want your users to see MySQL warnings produced by PHP. You want your code to detect errors and react gracefully to them.





Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top