dannyone Posted March 1, 2009 Share Posted March 1, 2009 hello everyone, im having trouble with this query, the query works just fine when updating a record that already exists in the database, however i would like it, if the user doesnt exist to create the user, i believe i need to do a insert into on duplicate key update query??..i have read the mysql site but just cant do it. can some1 help me please, many thanks heres my query @$todo=$_POST['do']; // take care of register global if off if(isset($do) and $do=="submit_form"){ $d_array=$_POST['d_array']; $tag_string=""; while (list ($key,$val) = @each ($d_array)) { //echo "$val,"; $tag_string.=$val.","; } $tag_string=substr($tag_string,0,(strLen($tag_string)-1)); if(mysql_query("update Marker set time='$tag_string' where Marker_ID= '" .$_SESSION['id'] . "'")){ echo "Data Updated<br>"; }else{echo mysql_error();} } thanks Link to comment https://forums.phpfreaks.com/topic/147472-solved-update-set-query-help/ Share on other sites More sharing options...
corbin Posted March 1, 2009 Share Posted March 1, 2009 You could possibly do UPDATE INTO. Link to comment https://forums.phpfreaks.com/topic/147472-solved-update-set-query-help/#findComment-774097 Share on other sites More sharing options...
dannyone Posted March 1, 2009 Author Share Posted March 1, 2009 thanks corbin, but i just tried it and its giving the same mysql syntax error Link to comment https://forums.phpfreaks.com/topic/147472-solved-update-set-query-help/#findComment-774118 Share on other sites More sharing options...
dannyone Posted March 1, 2009 Author Share Posted March 1, 2009 iv solved it thanks anyway Link to comment https://forums.phpfreaks.com/topic/147472-solved-update-set-query-help/#findComment-774180 Share on other sites More sharing options...
fenway Posted March 2, 2009 Share Posted March 2, 2009 iv solved it thanks anyway Um, how? Link to comment https://forums.phpfreaks.com/topic/147472-solved-update-set-query-help/#findComment-774407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.