php mysql 完整例子

    function getConnection(){
        @mysql_connect("localhost","username","password") or die("无法连接数据库");
        @mysql_select_db("databasename") or die("未找到数据库");
    }
 
    getConnection();
    $query="select definition,accession,gi from birds_nucleotide order by definition limit 0,200";
    $result=mysql_query($query);
    if(!$result){
        echo "查询失败";
        return false;
    }
    $resultCount=mysql_num_rows($result);
    for ($count = 0; $count<$resultCount; $count++) {
        //处理...
        echo mysql_result($result, $count,"definition");
    }
        
原文地址:https://www.cnblogs.com/frostbelt/p/2388743.html