| | |
Update Query is not Working..
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2008
Posts: 45
Reputation:
Solved Threads: 0
Hi all
In my Application i have wrote an update query but its not working..Anybody plz help me here am including my code...
'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...
In my Application i have wrote an update query but its not working..Anybody plz help me here am including my code...
PHP Syntax (Toggle Plain Text)
$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");
Then the die part of query is working ie its showing the error like "Could not Update"
Plz help...
Last edited by Tekmaven; Jul 15th, 2008 at 12:54 pm. Reason: Code tags
•
•
Join Date: Jul 2008
Posts: 13
Reputation:
Solved Threads: 2
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_mys...sql_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.
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_mys...sql_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.
Last edited by jsrpatna; Jul 15th, 2008 at 10:29 am.
Your update query should be like this:
Post if error occures...
php Syntax (Toggle Plain Text)
$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...
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
•
•
Join Date: Jul 2008
Posts: 13
Reputation:
Solved Threads: 2
•
•
•
•
Your update query should be like this:
php Syntax (Toggle Plain Text)
$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...
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!
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.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- MySQL update not working (PHP)
- UPDATE query problem (ASP.NET)
- UPDATE query not working properly... (PHP)
- Update query (mysql) (PHP)
- Error while trying the update query (ASP)
- how do i update to Access db? (C#)
- Help with a smyql query and php (MySQL)
- Multi-user program issues (VB.NET)
Other Threads in the PHP Forum
- Previous Thread: blog templates
- Next Thread: ERP projects
| Thread Tools | Search this Thread |
advanced alerts apache api archive array autosuggest beginner binary broken cakephp checkbox class clients cms code cron curl database date display dynamic echo email emptydisplayvalue eregi error execute explodefunction file files folder form forms function functions google hack href htaccess html if...loop image include insert ip javasciptvalidation javascript joomla keywords library limit link login mail matching menu mlm multiple mysql object oop paypal pdf php phpincludeissue problem query radio random recursion recursive remote script search searchbox server sessions shot smarty sms source space speed sql syntax system table tutorial update upload url validator variable vbulletin video web webdesign website youtube






