Jump to content

What's wrong with this PHP Line??


Padgoi

Recommended Posts

<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)){

Link to comment
https://forums.phpfreaks.com/topic/56153-whats-wrong-with-this-php-line/
Share on other sites

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.