|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
怎样学习,大家都知道编程是1门很枯燥的事业,所以大家一定要有兴趣,可能刚开始打算学的时候是因为别人说php有多好,php多么流行,但是后来伴随着学习的深入,你的这些 <style type="text/CSS">
input {font-family: "Verdana";font-size: "11px";BACKGROUND-COLOR: "#FFFFFF";height: "18px";border: "1px solid #666666";}
</style>
<?php
//mssql.php
$host="localhost";
$user="sa";
$password="";
$db="kao";error_reporting(7);
if(!$sql) $sql="select @@VERSION";
echo "<form action=\"\" method=\"post\">";
echo "SQL Query: <input type=\"text\" value=\"".$sql."\" size=\"120\" name=\"sql\">";
echo "<input type=\"submit\" name=\"next\" value=\"提交\">";
echo "</form>";
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("Provider=SQLOLEDB; Data Source=$host;
Initial Catalog=$db; User ID=$user; Password=$password");$rs = $conn->Execute($sql);
$num_columns = $rs->Fields->Count();
echo $num_columns . "\n";
for ($i=0; $i < $num_columns; $i++)
{
$fld[$i] = $rs->Fields($i);
}$rowcount = 0;
while (!$rs->EOF)
{
for ($i=0; $i < $num_columns; $i++)
{
echo $fld[$i]->value . "\t";
}
echo "\n";
$rowcount++;
$rs->MoveNext();
}$rs->Close();
$conn->Close();$rs->Release();
$conn->Release();$rs = null;
$conn = null;
?>
php与Access数据库毗连的代码
<?
$dbc=new com("adodb.connection");
$dbc.open("driver=microsoft access driver (*.mdb);dbq=c:\member.mdb");
$rs=$dbc->execute("select * from tablename");
$i=0;
while (!$rs->eof){
$i+=1
$fld0=$rs->field(0);
$fld1=$rs->field(1);
....
echo "$fld0->value $fld1->value ....";
$rs->movenext();
}
$rs->close();
?>
完成一个功能齐全的动态站点 |
|