300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > PHP处理SQL脚本文件导入到MySQL的代码实例【PHP】

PHP处理SQL脚本文件导入到MySQL的代码实例【PHP】

时间:2020-09-27 22:34:25

相关推荐

PHP处理SQL脚本文件导入到MySQL的代码实例【PHP】

后端开发|php教程

PHP,SQL文件,MySQL

后端开发-php教程

php开源游戏源码,ubuntu怎么删除账号,周口的爬虫馆,php架构代码,抚顺谷歌seolzw

<?php// Name of the file

$filename = churc.sql;

// MySQL host

$mysql_host = localhost;

// MySQL username

$mysql_username = oot;

// MySQL password

$mysql_password = \;

// Database name

$mysql_database = dump;

灰太狼辅助源码,vs对比vscode,ubuntu系统不自动休眠,项目发到tomcat,sqlite写库速度,flash图表插件,bui前端框架交流群,爬虫输入视频链接,php 代码生成,seo企业网站模板,资讯类手机网站模板,网页保存为图片 代码,点击图片弹出视频模板,招聘网站前台页面源码,客户预约管理系统php源码下载,协同管理程序源码lzw

// Connect to MySQL server

mysql_connect($mysql_host, $mysql_username, $mysql_password) or die(Error connecting to MySQL server: . mysql_error());

// Select database

mysql_select_db($mysql_database) or die(Error selecting MySQL database: . mysql_error());

直销系统源码,vscode怎么运行c 程序,ubuntu ltib,tomcat 多证书,sqlite c 事务,茶叶产品网页设计,网站服务器 数据库服务器,jquery图片拖拽插件,discuz 前端框架,爬虫备用编码,php 加密解密函数,seo优化技能,springboot脱敏原理,网站首页视频代码,网页美化教程,手机图片网站模板,织梦后台万能密码,h5 滚动页面切换,毕业论文 超市管理系统,支付宝 应用程序错误lzw

// Temporary variable, used to store current query

$templine = \;

// Read in entire file

$lines = file($filename);

// Loop through each line

foreach ($lines as $line)

{

// Skip it if its a comment

if (substr($line, 0, 2) == -- || $line == \)

continue;

// Add this line to the current segment

$templine .= $line;

// If it has a semicolon at the end, its the end of the query

if (substr(trim($line), -1, 1) == ;)

{

// Perform the query

mysql_query($templine) or print(Error performing query \\ . $templine . \\: . mysql_error() .

);

// Reset temp variable to empty

$templine = \;

}

}

echo "Tables imported successfully";

?>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。