欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 PHP连接和mysql的交互非常非常方便,API接口也和mysql 的C api非常相似测试:新建一个mysql表数据库phpmyadmin建表语句:view plain CREATE TABLE IF NOT EXISTS `student` (`id` int(11) NOT NUL
欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入
PHP连接和mysql的交互非常非常方便,API接口也和mysql 的C api非常相似测试:新建一个mysql表数据库phpmyadmin建表语句:view plain CREATE TABLE IF NOT EXISTS `student` (`id` int(11) NOT NULL,`name` varchar(60) NOT NULL,`age` int(11) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;使用参数 作为输入insert:view plain
{ die('connect failed: ' . mysql_error());}
mysql_select_db("phpmyadmin", $con);
if(!mysql_query("insert into student VALUES($argv[1], '$argv[2]', $argv[3])"))
{ die('Insert Error: ' . mysql_error());} else { echo "Insert Success";}
mysql_close($con);?>
使用参数作为输入select:view plain
{ die('connect failed: ' . mysql_error());}
mysql_select_db("phpmyadmin", $con);
$result = mysql_query("SELECT * FROM student where id = $argv[1]");
while($row = mysql_fetch_array($result))
{ echo "name: " . $row['name'] . "\n";echo "id: " . $row['age'] ;echo "\n";}
mysql_close($con);?>
测试:view plain $ php insert_test.php 1 peter 20 Insert Success $ php insert_test.php 2 lucy 30 Insert Success $ php select_test.php 1 name: peter id: 20 $ php select_test.php 2 name: lucy id: 3

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

SublimeText3 英文版
推荐:为Win版本,支持代码提示!

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器