Current location: Hot Scripts Forums » Programming Languages » PHP » Update SQL


Update SQL

Reply
  #1 (permalink)  
Old 10-05-03, 12:23 AM
alirezaok alirezaok is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Question Update SQL

Why this SQL show "no sucsessfull update" alway ?

<?php
include("config.php");
$Link = mysql_connect ($Host, $User, $Password);
$Query = 'UPDATE $TableName SET `title` = \'test\','
. ' `lid` = \'test\','
. ' `body` = \'test\' WHERE `id` = \'$id\';'
. ' ';
if (mysql_db_query ($DBName, $Query, $Link)) {
print ("<div align=center>successfulle update</div>\n");
} else {
print ("no sucsessfull update");
}
?>

i sure that connect to mysql and table is true because row delete works but update not works ...
Reply With Quote
  #2 (permalink)  
Old 10-07-03, 03:09 AM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Quote:
Originally Posted by alirezaok
Why this SQL show "no sucsessfull update" alway ?

<?php
include("config.php");
$Link = mysql_connect ($Host, $User, $Password);
$Query = 'UPDATE $TableName SET `title` = \'test\','
. ' `lid` = \'test\','
. ' `body` = \'test\' WHERE `id` = \'$id\';'
. ' ';
if (mysql_db_query ($DBName, $Query, $Link)) {
print ("<div align=center>successfulle update</div>\n");
} else {
print ("no sucsessfull update");
}
?>

i sure that connect to mysql and table is true because row delete works but update not works ...
A couple of thoughts...
1. Are the 3 references to 'test' all supposed to be the named test, or did you substitute 'test' for another word?
2. Try your query like this...
$Query=("UPDATE $Tablename SET title='$test', lid='$test', body='$test' WHERE id='$id'");
3. Is the information you're updating coming from another form, and is it passing the information to this properly?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
type mismatch and update loop - HELP! seala ASP 1 09-22-03 05:27 PM
Just learning: how do I update information in table? paulj000 PHP 3 08-07-03 10:49 AM
ASP Calendar..HELP...pls jimthepict ASP 1 07-31-03 05:01 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM
Web Interface for SQL Server 2000 Greg Database 2 06-16-03 09:00 AM


All times are GMT -5. The time now is 06:30 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.