虛拟主機(jī)域名注冊-常見(jiàn)問(δ©wèn)題 → 數(shù)據庫問(wèn)題 → 數(shù)據庫問(wèn)題 | |||||||
如(rú)何連接mysql數(shù)據庫?
我司的(de)Mysql可(kě)以在虛拟主機(jβ©©πī)管理(lǐ)中心》數(shù)據庫》管理(lǐ)my∞sql數(shù)據庫(http://mysql.myhostadmin.net),直接在線管理(lǐ),您也(yě)可(kě)以自(zì™₩)己下(xià)載一(yī)個(gè)Phpmyadmin上(shàng)傳至λ←您的(de)空(kōng)間(jiān)裡(lǐ)面進行β∑§≥(xíng)數(shù)據庫的(de)管理(÷☆lǐ)。
<?
/*本例是(™♥"shì)用(yòng)PHP4連接一(yī)個(gè)m★♦<✘ysql數(shù)據庫操作(zuò)的(≥♣de)演示, &nb•σ≥sp;實現(xiàn)連接打開(kāi)一(y↕∑βī)個(gè)庫,并讀(dú)取數(shù)據的(de)基本功能(nén♣©©g)。 */ ?> <HTML> <HEAD> <META NAME="©φGENERATOR" Content="Microsoft&nb₩∏sp;Visual Studio σβ;6.0"> <style type="text/csα"s"> <!-- input { font-size®©':9pt;} A:link {text-decoration: unde≈₽✔™rline; font-size:9pt;color:000©059} A:visited {text-decoration:© underline; font-s✔ ✔↓ize:9pt;color:000059} A:active {text-decora±σλtion: none; fo&∞ππnt-size:9pt} A:hover {text-decoration:underli✘ ↕♣ne;color:red} body,table {font-sβ₽ize: 9pt} tr,td{font-size:9pt} --> </style> <title>注冊會(huì)員(yuán)列表&nb±φ☆sp;- 讀(dú)取mysql的(de)¶☆×測試</title> </HEAD> <body alink="#FF0±φ000" link="#000099" vlin ≈≤≠k="#CC6600" topmarα≠gin="8" leftmargin="0" bg'&δColor="#FFFFFF"> <br><br><center&g↑™t;<font color=green size=3®™↑♥><b>注 冊 會(huì)&n&$✘bsp;員(yuán) 列&nbs∏↔p;表</b></font&g'¶t;</center> <br> <table cellspacing=0&nφ♠bsp;bordercolordark=#FFFFFF&nb±≥÷ sp;width="95%" bordercolorlight=#0$Ω✔00000 border=1 align="ceΩ∞nter" cellpadding="2"> <tr bgcolor="#6₹←b8ba8" style="color:FFFFFF"&≠€≤gt; <td&γ✔nbsp;width="5%" align="•®center" valign="bΩ∞®ottom" height="19">ID</td&g♥βπt; <td wid→•th="10%" align="center"&Ω nbsp;valign="bottom">姓£®名</td> &nφβ±bsp;<td width="5%"&n×☆bsp;align="center" valign="bo£♠γttom">性别</td> <td&nb£δsp;width="5%" align="cent÷£er" valign="bottom">年(₩¶λnián)齡</td> <td wiδ σ≤dth="20%" align="center"♠≥ valign="bottom">聯">÷系電(diàn)話(huà)</td&g≥≤∏∑t; <td ∏&∑width="20%" align="c¶>enter" valign="botto₽♦σm">電(diàn)子(zǐ)郵件(jiàn)</td® > <td&σ÷nbsp;width="20%" align="center"&nb₽✘€γsp;valign="bottom">家(jiā)庭住址</t ≠αd> </tr>π♠ <? //連接到(dào)本>§↑地(dì)mysql數(shù)據庫 $myconn=α±mysql_connect("localhost","root",""™♦§→);  ♦±¶;//選擇test為(wèi)操作(zuò)庫 γ≈÷mysql_select_db("test",$m←φyconn); $sσ$£trSql="select *&nbs<×¥±p;from reguser"; //用(yòn&>g)mysql_query函數(shù)從(cóng)user表裡(πε£€lǐ)讀(dú)取數(shù)據 $result=mysql_δ★< query($strSql,$myconn)•™; while($roπδλ¶w=mysql_fetch_array($reβλsult))//通(tōng)過循環讀(dú)取數(sh↓≈±∞ù)據內(nèi)容 { ?> <tr> <td ali✘→←€gn="center" height="19"><$€ ₩;?echo $row["id"]?></td& ♦gt; <td&n♣→§bsp;align="center">><?echo $row["userid"]?∏≈₹"></td> <td&nb☆§•φsp;align="center"><?e₩♠∞cho $row["sex"] ∞?></td>  ♦£Ω;<td align="center"><∑"?echo $row["age"]?></td> <td&nbsΩ€☆γp;align="center"><?echo&nΩπbsp;$row["tel"]?></td> ∏<td align="cente>€r"><?echo $row["email♦ "]?></td> <td a✔¶lign="center"><?echo $roε§↑w["address"]?></td> </tr>α&≠↑; <? } //↓§關閉對(duì)數(shù)據庫的(de)連接  ×&;mysql_close($myconn); ?> </table> </BODY> </HTML>
|
|||||||
>> 相(xiàng ♠)關文(wén)章(zhāng) | |||||||
沒有(yǒu)相(xiàng)關文(w"♣β↑én)章(zhāng)。 |