-3

データベース行をオブジェクトに挿入しようとしていますが、ここで何が問題なのかわかりません:(出力が表示されません)。

<body>
<?php header('Content-Type: text/html; charset=utf-8');
include("dash_class.php");
mysql_connect("localhost", "root", "") or
    die("Could not connect: " . mysql_error());
mysql_select_db("msordash");
mysql_query("SET NAMES 'utf8'");
$dashim=mysql_query("SELECT * FROM dash");

while ($row = mysql_fetch_array($dashim)) { 
    $dash=new dash($row["name"],$row["msg"],$row["msg_date"]);

    echo $dash->name;
}
?>

</body>

クラスコード:

class dash
{
public $name;
public $msg;
public $msg_date;

function __constractor($name,$msg,$msg_date){
$this->name=$name;
$this->msg=$msg;
$this->msg_date=$msg_date;}


}

?>
4

1 に答える 1

0

constraaaaaaaaaaactor とは何ですか? :)すみません、constractor正確には何ですか?

function __constractor($name,$msg,$msg_date){

そのはず

__construct()

お気に入り

function __construct($name,$msg,$msg_date){
于 2013-03-27T17:09:25.630 に答える