problem with mysql_fetch_assoc()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
smileboy
Forum Newbie
Posts: 20
Joined: Wed Mar 11, 2009 6:58 am
Location: Tashkent, Uzbekistan

problem with mysql_fetch_assoc()

Post by smileboy »

hi i'm having a problem with mysql_fetch_assoc() saying:

Code: Select all

 
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a1791845/public_html/view.html on line 21
my view.html is this:

Code: Select all

 
<html>
<head></head>
<link href="dirty money.css" rel="stylesheet" type="text/css">
<body>
<div id="wrapper">
<div id="header"></div>
<div id="navigation">
<p id="menu">
<a href="last.php">Oxirgi kiritilganlar</a> <a href="add.html">Kirit</a> <a href="chat.php">Chat</a> <a href="themes.php">Temalar</a> <a href="titles.html">So`zlarni ko`rish</a>
</p>
</div>
<div id="leftcolumn">leftcol</div>
<div id="content">
<p id="main">
<?PHP
  $connection = mysql_connect("host", "user", "********") or die(mysql_error());
  mysql_select_db("a1791845_jargon") or die(mysql_error());
  $title = "SELECT title.word, words.title, words.id * FROM words, title WHERE title.word = words.title";
  $result = mysql_query($title, $connection);
   while($row = mysql_fetch_assoc($result)){
?>
 <a href="exam.php?id=<?PHP echo $row['id']; ?>"><?PHP echo $row['word']; ?></a>
 <?PHP } ?>
</div>
<div id="footer">footer</div>
</div>
</body>
</html>
 
i can't figure out where is mistake. where is my mistake is or did i miss something. if you know. help please
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: problem with mysql_fetch_assoc()

Post by Mark Baker »

The problem is here:
$title = "SELECT title.word, words.title, words.id * FROM words, title WHERE title.word = words.title";
smileboy
Forum Newbie
Posts: 20
Joined: Wed Mar 11, 2009 6:58 am
Location: Tashkent, Uzbekistan

Re: problem with mysql_fetch_assoc()

Post by smileboy »

i think i have that asterix (*) sign in my code

or should i remove that?
smileboy
Forum Newbie
Posts: 20
Joined: Wed Mar 11, 2009 6:58 am
Location: Tashkent, Uzbekistan

Re: problem with mysql_fetch_assoc()

Post by smileboy »

Yeah that's right. i've removed that and it works.
thanx 4 ur help
Post Reply