Execute a .SQL file from PHP code
// executes the SQL commands from an external file.
$file = "sqlQueryfile.sql";
//Check if file exists
if (!file_exists($file))
{
die("Error : "The file $file does not exist.");
}
$str = file_get_contents($file);
if (!$str)
{
die("Error : Unable to read the contents of $file.");
}
$this->last_query = $str;
// split all the query's into an array
$sql = explode(';', $str);
foreach ($sql as $query)
{
if (!empty($query))
{
$r = mysql_query($query);
if (!$r)
{
die("Error : "mysql_error());
}
}
}
Tuesday, March 3, 2009
Subscribe to:
Post Comments (Atom)
FUTURE BLUE CHIP BUY NSE #COALINDIA ABOVE 280 TARGET 283-285 SL 276.5
ReplyDeleteOUR FIRST TGT 283 IN COALINDIA BUY CALL, ONCE BOOK PARTIAL PROFIT NOW 282 AND TRAIL SL AT COST
Free Tips
Technical Strategies showed here with best example. Nice to read daily
ReplyDeleteTrade India Research Reviews