A section of code execution related issues

Source: Internet
Author: User
A section of code execution issues
PHP Code
  
  805) {$h = ($m [2]*805)/$m [1];        $k = 805;    $ptext = Preg_replace ('/(width=) ' (\d+) "(\s*height=)" (\d+) "/I", ' $ '. $k. ' $ "'. $h. '" ', $m);    } mysql_query ("Set names ' GBK '");    $sql = "Update pagecontents set Page_text = (' {$ptext} ') Where page_id = (' {$pid} ')"; mysql_query ($sql) or Die (Mysql_error ());}? >



The result is that 2 sentences have been executed.
HTML Code
  
   Part Page_text////    


What was meant to be done was to change the width over 805, which was the first one, and all the results were replaced.

------Solution--------------------
$m [1] returns all matching content.

Print_r, look, you'll know.
------Solution--------------------
The problem hasn't been solved yet? You posted a few paragraphs. In the end, that paragraph is the standard. The question is not clearly described.
------Solution--------------------
Remember I wrote you a code.
PHP Code
$page _text =<<< TXT      txt;echo preg_replace_callback (' #width = "(\d+)" \s*height= "(\d+)" #i ", ' Back ', $page _ text);//$m [1] is the value of width, $m [2] is the value of height. function back ($m) {    if ($m [1]>805) {        $h =round ($m [2]*805)/$m [1]);        $k =805;        Return "width=\" $k \ "height=\" $h \ "";    }    return $m [0];}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.