Jump to content

Recommended Posts

looks like i'm going to have to do this the hard way, by posting multiple questions to get this done. From what i'm reading its taking all the from post that have add in them and Updating it into the database. my question is, what if the entry / value doesn't exist in the table already will it perform an insert?

 

 

 

        foreach ($_POST['add'] as $key => $value)

                mysql_query("UPDATE $membtable SET m_".$key."='".sql_escape_string(stripslashes($value))."' WHERE m_id=$id");

Link to comment
https://forums.phpfreaks.com/topic/126636-update-query-question/
Share on other sites

I don't understand your question.  Are you asking if you can INSERT a new ROW if it doesn't exist or UPDATE it if it does?  If so, then what I linked would do it

 

What do you mean by "entry/value" ?  Do you mean a field name or do you mean the data?

I don't understand your question.  Are you asking if you can INSERT a new ROW if it doesn't exist or UPDATE it if it does?  If so, then what I linked would do it

 

What do you mean by "entry/value" ?  Do you mean a field name or do you mean the data?

 

if i don't change the coding below, will a blank field be updated with the form value?

 

foreach ($_POST['add'] as $key => $value)

                mysql_query("UPDATE $membtable SET m_".$key."='".sql_escape_string(stripslashes($value))."' WHERE m_id=$id");

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.