If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > update query with php

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-20-03, 13:40
atroz atroz is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
Question update query with php

Hi all
i have a problem with my update query in php , i try to update the last record , i try with this but update all the records and not only the last i dont know what´s wrong ...any ideas?


$query = "UPDATE table1 SET Object1='one', Object2='two', Object3='three' WHERE id=LAST_INSERT_ID(table1.id)";


thanks a lot
Reply With Quote
  #2 (permalink)  
Old 10-20-03, 15:36
omiossec omiossec is offline
Registered User
 
Join Date: Jan 2003
Location: Paris, France
Posts: 320
$query = "UPDATE table1 SET Object1='one', Object2='two', Object3='three' WHERE id=LAST_INSERT_ID()";

LAST_INSERT_ID() with an argument return the value of the argument
__________________
Olivier Miossec
--
http://www.lasso-developpeur.net/
--
Reply With Quote
  #3 (permalink)  
Old 10-23-03, 20:56
atroz atroz is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
Unhappy

i really have problems with that i do query but dont work ( dont make any update ) tell my plz if i have a sintaxys error or a concept mistake

$query = "UPDATE $table SET pregunta1='one', pregunta2='two', pregunta3='three' WHERE id=LAST_INSERT_ID()";
Reply With Quote
  #4 (permalink)  
Old 12-04-05, 17:48
linux linux is offline
Registered User
 
Join Date: Nov 2003
Location: sweden
Posts: 17
test to write you query like this one

$query = "UPDATE $table SET (pregunta1,pregunta2,pregunta3 )= ('one','two','three' ) WHERE id=LAST_INSERT_ID()";
__________________
Linux
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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