問題が何であるか把握してください!mysql_num_rowsエラー
$msgs = mysql_num_rows(mysql_query("SELECT * FROM messages WHERE recipient = $userID AND read = 0"));
echo $msgs;
上記のコードは、 "and read = 0"を削除すると機能します。しかし、もし私が得なければ:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in left_menu.php on line 16。
私はテーブルのフィールドを持っているが(TINYINT 1、defualt 0)
CREATE TABLE IF NOT EXISTS `messages` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`sender` int(10) unsigned NOT NULL DEFAULT '0',
`recipient` int(10) unsigned NOT NULL DEFAULT '0',
`subject` varchar(255) CHARACTER SET utf8 NOT NULL,
`message` text CHARACTER SET utf8,
`date` int(10) unsigned NOT NULL DEFAULT '0',
`read` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
INSERT INTO `messages` (`id`, `sender`, `recipient`, `subject`, `message`, `date`, `read`) VALUES
(1, 47, 13, 'Hello!', 'TEST!', 1228326055, 0),
(2, 536, 13, 'blblabla', 'yeah', 1248506708, 0);
いただきました問題読み取りと呼ばれますか?
フィールド上の名前が変更されたことはわかりません。ありがとう! –