<?php
require_once('db_fun.inc.php');
//$db_obj=new DBSQL();
//$db_obj->_construct();
$conn=db_conn();
if ($conn)
{
$result=mysql_query("select now() as yy",$conn);
if(! $result)
echo "select failed.";
else
$num = mysql_num_rows($result);//获取行数
for($i=0;$i<$num;$i++)
{
$row=mysql_fetch_object($result);
echo $row->yy;
}
}
else
{
echo "dddddddddd";
}
?>
----------------------------------------------------
<?php
function db_conn(){
// $conn=mysql_connect(ServerName,UserName,PassWord);
$conn=mysql_connect("10.1.0.7","ccc","ccc");
if(!$conn)
{
return false;
}
else
{
if(!mysql_select_db("vote",$conn))
{
return false;
}
else
{
return $conn;
}
}
}
?>