Page 1 of 1

problem with mysql_fetch_assoc()

Posted: Wed Mar 25, 2009 7:05 am
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

Re: problem with mysql_fetch_assoc()

Posted: Wed Mar 25, 2009 7:15 am
by Mark Baker
The problem is here:
$title = "SELECT title.word, words.title, words.id * FROM words, title WHERE title.word = words.title";

Re: problem with mysql_fetch_assoc()

Posted: Wed Mar 25, 2009 7:24 am
by smileboy
i think i have that asterix (*) sign in my code

or should i remove that?

Re: problem with mysql_fetch_assoc()

Posted: Wed Mar 25, 2009 7:28 am
by smileboy
Yeah that's right. i've removed that and it works.
thanx 4 ur help