Nasıl MySQL veri güncelleme yok

0 Cevap php

Ben birden aynı anda option_id @ option_name ile veri güncellemek için bulanıklık alıyorum.

Güncel db

option_id   option_name        option_content           option_status
1           web_url            http://localhost.com     1
2           web_name           My Website               1
3           web_description    Welcome to my website    1
4           web_keywords       movies, power, ranger    1

php veri güncelleme

$web_name    = $_POST['web_name'];
$web_url     = $_POST['web_url'];
$web_desc    = $_POST['web_desc'];
$web_keyword = $_POST['web_keyword'];

Update From DR anwser

$query = "UPDATE web_options SET option_content=
      '{$db->string_escape($web_name, true)}'
      WHERE option_name = 'web_name'";
$db->rq($query);

$query = "UPDATE web_options SET option_content=
     '{$db->string_escape($web_url, true)}'
      WHERE option_name = 'web_url'";
$db->rq($query);

$query = "UPDATE web_options SET option_content=
     '{$db->string_escape($web_desc, true)}'
      WHERE option_name = 'web_desc'";
$db->rq($query);

$query = "UPDATE web_options SET option_content=
     '{$db->string_escape($web_keyword, true)}'
      WHERE option_name = 'web_keyword'";
$db->rq($query);

Bu güncelleştirme, daha basit sorguları yapmak için bir yol var mı?

0 Cevap