php调用存储过程

来源:互联网 发布:无锡达内软件 编辑:程序博客网 时间:2024/05/16 15:30

例子程序。

 

<?php
    define('CLIENT_MULTI_RESULTS', 131072);

    $link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());
    mysql_select_db("vs") or die("Could not select database");
?>

        <?php
        $result = mysql_query("call get_news_from_class_id(2)") or die("Query failed:" .mysql_error());
        while($row = mysql_fetch_array($result, MYSQL_ASSOC))
        {
                $line = '<tr><td><a target = _blank href=/''.$row["url"].'/'>'.$row["title"].'('.$row["page_time"].')'.'</a></td></t
r>';
                echo $line;
                printf("/n");

        }
        mysql_free_result($result);
        ?>

 

<?php
    mysql_close($link);
?>