谁能帮助我。我收到错误警告:mysql_fetch_assoc():提供的参数不是有效的 MySQL 结果资源...
我的代码:
include("../connection.php");
$con=mysql_connect($host, $username, $password, $db_name) or die ("insert error message");
mysql_select_db("db") or die ("Couldn't find database");
$story=mysql_query("SELECT hand_story.username, hand_story.age, hand_story.occupation,
hand_story.star_sign, hand_story.cats_and_dogs, hand_story.holiday, hand_story.single,
hand_story.story, big_hand_images.username, big_hand_images.url
FROM hand_story
INNER JOIN big_hand_images
ON hand_story.username=big_hand_images.username
WHERE big_hand_images.url='$guess'");
echo (mysql_error());
while($row = mysql_fetch_assoc($story)){
$age = $row['age'];
$occupation = $row['occupation'];
$star_sign = $row['star_sign'];
$cats_and_dogs = $row['cats_and_dogs'];
$holiday = $row['holiday'];
$single = $row['single'];
$story = $row['story'];
}
我可以从数据库中回显结果,所以它可以工作,但我不知道为什么我也会收到错误消息。
任何人都可以帮忙吗?这与我的 SQL 查询有关吗?塔