php - Using Mysql query with where condition -
i have decoded json , want submit in database,
how can use query condition?
if(is_array($arr)){ $sql = "insert wp_posts (post_title, post_type) values "; $valuesarr = array(); foreach($arr $row){ $email = mysql_real_escape_string( $row['property_name'] ); $post = mysql_real_escape_string( $row['post_type'] ); $valuesarr[] = "('$email', '$post')"; } $sql .= implode(',', $valuesarr); mysql_query($sql) or exit(mysql_error()); }
if(is_array($arr)){ $valuesarr = array(); foreach($arr $row){ $email = mysql_real_escape_string( $row['property_name'] ); $post = mysql_real_escape_string( $row['post_type'] ); $sql = "update wp_posts set post_title='".$email."', post_type='".$post."' x=y"; mysql_query($sql) or exit(mysql_error()); } }
Comments
Post a Comment