开发者

running around 220 insert into mysql and php

开发者 https://www.devze.com 2023-03-17 03:11 出处:网络
I have about 20 files which have mysql queries to be run, Example of file1.php,file2.php,file3.php <?php

I have about 20 files which have mysql queries to be run,

Example of file1.php,file2.php,file3.php

<?php
$s = array();
foreach($j as $y) {
//codes
$s[] = "($link, $img)";
}

mysql_query("INSERT INTO xyz VALUES ".implode(',',$s));
?>

file1.ph开发者_如何学Pythonp,file2.php,file3.php are more about same and requires insert into queries to be run. //insert into varies on each file and dynamic based on input

I have run.php which

<?php
require 'file1.php';
require 'file2.php';
require 'file3.php';
?>

so the execution of file1, file2 and file3 depends on run.php

is this safe way to do it? or should i move the mysql insert into at run.php (run all queries together) instead of leaving it in individual files (file1,file2,file3).

What would be the best way to send data from file1.php to run.php? method, echo?


There is no problem in doing this. All maters that you initiate the transaction before starting all the queries and commit in the end OR rollback in case of exception.

0

精彩评论

暂无评论...
验证码 换一张
取 消