Hi all
In my Application i have wrote an update query but its not working..Anybody plz help me here am including my code...

$head=$_GET['val'];
$date=$_REQUEST['txtdate'];
$headline=$_REQUEST['txthead'];
$update="Update tbl_circular SET date='$date',headline='$headline',description='$des' where headline like '$head')";
$update1=mysql_query($update) or die("Could not Update");

'val' is the querystring am passing to the page..

Then the die part of query is working ie its showing the error like "Could not Update"
Plz help...

Hi,

I think you need to use wild card % and rephrase your sql query.

like %'.$head.'%

Are you not useing the . operator to create a dynamic query?

You can learn more about how to create a dynamic query at http://www.tutorialindia.com/php_mysql/php_mysql_update.php without . (Dot) operator your query is not dynamic and hence the error.

Also, be sure to create an sql date in correct format.

You need to
1. Create a dynamic query using the . dot operator.
2. Create the date correctly

You can remove the date field temporarily and update the query after sometime once your basic update is working. Feel free to send me a direct message in case of ny problem. I will answer within one day.

Hope this helps.

Your update query should be like this:

$qur= "update tbl_circular set `date`='".$date."', `headline`='".$headline."', `description`='".$des."' where headline like  '%".$head."%'";	
$update1=mysql_query($update) or die("Could not Update");

Post if error occures...

Your update query should be like this:

$qur= "update tbl_circular set `date`='".$date."', `headline`='".$headline."', `description`='".$des."' where headline like  '%".$head."%'";	
$update1=mysql_query($update) or die("Could not Update");

Post if error occures...

Hi,

This query might still have a little problem with the date field! Best thing would be to strip the query of date field, try the update query. When it works fine go for date.

Bye!

Check your system date format with database date format...means yy-mm-dd like this...
Tel me what error you got...

date is a mysql reserved keyword. Its better if you change the column name "date" to something else. If you don't want to change the column name, use ` around the column name. Oh, btw, if your query isn't still working, print your query and execute it in mysql console/phpmyadmin.

i have got solution to applying the above code its working fine thnk u Shanti...

welcome...
if u got solution make this thread as solved,then other will search solved threads....

This question has already been answered. Start a new discussion instead.