Padgoi Posted June 19, 2007 Share Posted June 19, 2007 <code><?php if(isset($_SESSION["user"]) and isset($_SESSION["userid"])) { $q2="select * from profiles where usId='$id' order by id asc"; $res2=mysql_query($q2); $comic=mysql_fetch_array($res2); $title=$comic['title']; $maintitle=$title; $author=$comic['creator']; $authors="<a href=?u=$author>$author</a>"; $imagesrc=$comic['file']; $key=$comic['usId']; $i=1; while($comic=mysql_fetch_array($res2)){ $title=$comic['title']; $author=$comic['creator']; $imagesrc=$comic['file']; $id=$comic['usId']; $authors.=", <a href=?u=$author>$author</a>"; $i++; echo '<td><A HREF\="prof_comments.php?uid=$id\" target=\"new\">View/Add Comments</A></td>'; }} ?> </code> I keep getting an error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /html/testmates/friend_info.php on line 133 133 - $comic=mysql_fetch_array($res2); Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /html/testmates/friend_info.php on line 142 142 - while($comic=mysql_fetch_array($res2)){ Quote Link to comment https://forums.phpfreaks.com/topic/56153-whats-wrong-with-this-php-line/ Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 select should be SELECT from should be FROM where shoudl be WHERE order by should be ORDER by asc should be ASC, also if it is returning 0 results it will fail on the fetch Quote Link to comment https://forums.phpfreaks.com/topic/56153-whats-wrong-with-this-php-line/#findComment-277381 Share on other sites More sharing options...
teng84 Posted June 19, 2007 Share Posted June 19, 2007 pls if theres an error include the error Quote Link to comment https://forums.phpfreaks.com/topic/56153-whats-wrong-with-this-php-line/#findComment-277386 Share on other sites More sharing options...
Padgoi Posted June 19, 2007 Author Share Posted June 19, 2007 Ok, so I added this code: <td>Comments</td> <?php $res2=mysql_query('SELECT * FROM users WHERE usID="'.$_GET['uid'].'"'); $comic=mysql_fetch_array($res2); $key=$comic['uid']; $i=1; while($comic=mysql_fetch_array($res2)){ $id=$comic['uid']; ?> <td><A HREF="prof_comments.php?uid=<?PHP echo $id; ?> target="new">View/Add Comments</a></td> <?php } ?> Why isn't the a href function displaying at all? Quote Link to comment https://forums.phpfreaks.com/topic/56153-whats-wrong-with-this-php-line/#findComment-277406 Share on other sites More sharing options...
Shaned145 Posted June 19, 2007 Share Posted June 19, 2007 cause its still in the PHP code. Change it to: <?php } ?> <td><A HREF="prof_comments.php?uid=<?PHP echo $id; ?> target="new">View/Add Comments</a></td> EDIT: Oh wait...hmmm...I dont know Quote Link to comment https://forums.phpfreaks.com/topic/56153-whats-wrong-with-this-php-line/#findComment-277411 Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 cause u didn't close the logical while function Quote Link to comment https://forums.phpfreaks.com/topic/56153-whats-wrong-with-this-php-line/#findComment-277416 Share on other sites More sharing options...
neel_basu Posted June 19, 2007 Share Posted June 19, 2007 Use $res2=mysql_query($q2) or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/56153-whats-wrong-with-this-php-line/#findComment-277418 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.