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 Quote 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. Quote 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 Quote 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 Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.