-1
新しいデータベースにsqlファイルをインポートした後、foreachループの状態を確認する必要があります。私はそれを行う方法がわかりません。PHPのforeach()ループの状態をチェックするには?
//import tables into new db
$newconn = new mysqli($servername, $username, $password, $newDB);
$filename = 'tables.sql';
$op_data = '';
$lines = file($filename);
foreach ($lines as $line)
{
if (substr($line, 0, 2) == '--' || $line == '')//This IF Remove Comment Inside SQL FILE
{
continue;
}
$op_data .= $line;
if (substr(trim($line), -1, 1) == ';')//Breack Line Upto ';' NEW QUERY
{
$newconn->query($op_data);
$op_data = '';
}
}
if(foreach == SUCCESS){
echo 'Success! Gabriel escaped Negan!';
}else{
echo 'Crap! Father Gabriel died!';
}
foreach == success ...とはどういう意味ですか? – scaisEdge
ステータスとは正確にはどういう意味ですか?それが終わったら?それは何の反復ですか? – abney317
@ abney317:foreachが終了したときに何をすべきかをプログラムに伝えたい。 –