Yammyguy Posted April 1, 2009 Share Posted April 1, 2009 267 function article_query(){ 268 $project = $_POST["project"]; 269 $keyword = $_POST["keyword"]; 270 $sql = ("SELECT * FROM mag_art_desc WHERE article = '$project' AND keywords LIKE '%$keyword%'"); 271 echo'<ol>'; 272 while($mags = mysql_fetch_array($sql)){ 273 echo'<li><b>'.$row[2].'</b> As found in '.$row[3]; 274 } 275 echo'</ol>'; 276 } I've put the line numbers in my code so you can see where the error is claiming issues... here's the error I'm getting: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/article/index.php on line 272 I've copied and pasted the code as is into phpMyAdmin (replacing the variables with the proper values, of course) and the query executes exactly as I want. But since I've copied it into my code here - it just errors out. Any help would be VERY MUCH appreciated! Link to comment https://forums.phpfreaks.com/topic/152018-solved-query-errors-when-accessing-table/ Share on other sites More sharing options...
genericnumber1 Posted April 1, 2009 Share Posted April 1, 2009 Change $sql = ("SELECT * FROM mag_art_desc WHERE article = '$project' AND keywords LIKE '%$keyword%'"); to $sql = mysql_query("SELECT * FROM mag_art_desc WHERE article = '$project' AND keywords LIKE '%$keyword%'"); just forgot the function name Link to comment https://forums.phpfreaks.com/topic/152018-solved-query-errors-when-accessing-table/#findComment-798343 Share on other sites More sharing options...
Yammyguy Posted April 1, 2009 Author Share Posted April 1, 2009 D'OH! Thanks! Must be getting tired. Link to comment https://forums.phpfreaks.com/topic/152018-solved-query-errors-when-accessing-table/#findComment-798346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.