1、 用php进行select
[www@Cent64JBWweb6 tmp]$ czx.php
<?php
$conn = mysql_connect("10.72.24.178","user","xxxxxxx") or die ("wrong!");
$sel=mysql_select_db("jyldb",$conn);
$sql="select id from zhix_chen";
$que=mysql_query($sql,$conn);
while ($row = mysql_fetch_assoc($que)) {
$mobile = trim($row["id"]);
echo $mobile ;
}
if($que)
echo"true";
else
echo "wrong";
?>
:wq
如下方法执行脚本:
[www@Cent64JBWweb6 tmp]$
php czx.php
2、用php进行insert
[www@Cent64JBWweb6 tmp]$ cat czx.php
<?php
$conn = mysql_connect("10.72.24.178","user","xxxx") or die ("wrong!");
$sel=mysql_select_db("jyldb",$conn);
$sql="insert into `jyldb`.`zhix_chen` values (5,'dd',5)";
$que=mysql_query($sql,$conn);
if($que)
echo"true";
else
echo "wrong";
?>
:wq
如下方法执行php脚本:
[www@Cent64JBWweb6 tmp]$ php czx.php
<!--?php
-->
$conn = mysql_connect("10.72.24.178","user","xxxxxxx") or die ("wrong!");
$sel=mysql_select_db("jyldb",$conn);
$sql="select id from zhix_chen";
$que=mysql_query($sql,$conn);
while ($row = mysql_fetch_assoc($que)) {
$mobile = trim($row["id"]);
echo $mobile ;
}
if($que)
echo"true";
else
echo "wrong";
?>
:wq
如下方法执行脚本:
[www@Cent64JBWweb6 tmp]$
php czx.php
2、用php进行insert
[www@Cent64JBWweb6 tmp]$ cat czx.php
<!--?php
$conn = mysql_connect("10.72.24.178","user","xxxx") or die ("wrong!");
$sel=mysql_select_db("jyldb",$conn);
$sql="insert into `jyldb`.`zhix_chen` values (5,'dd',5)";
$que=mysql_query($sql,$conn);
if($que)
echo"true";
else
echo "wrong";
?>
:wq
如下方法执行php脚本:
[www@Cent64JBWweb6 tmp]$ php czx.php
转载于:http://blog.itpub.net/28916011/viewspace-1815392/