{% else-1 %}
Обновление базы MySQL в цикле

                        
error_reporting(1);
// first connect to database
$dbcnx = @mysql_connect("localhost","root","pass");
$dbselect = @mysql_select_db("db");

$query = "SELECT id, imsize
FROM b_new_tires_filter";
$result = mysql_query($query) or die('Error: '.mysql_error());

while($row = @mysql_fetch_array($result)) {
extract($row);
$m = array();
preg_match("/([0-9]{3})([0-9]{2})([0-9]{2})/", $imsize, $m);

echo $id." - ".$imsize." - ".$m[1]."/".$m[2]."/".$m[3]."";
$query2 = "UPDATE b_new_tires_filter SET tire_width='".$m[1]."', tire_aspect_ratio='".$m[2]."', tire_diameter='".$m[3]."' WHERE id = '".$id."'";
mysql_query($query2) or die('Error: '.mysql_error());
}
mysql_close();
-1 52 0
0

Нет фото
Vol"jin * 5.23
• 14 апр 2015, 10:47


Для чего он