Jump to content

Error: Resource id #97 Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in /var/www/Joomla_Version_Control/components/com


KenKinoti

Recommended Posts

Hi i know am kinda new to this but i keep getting this error above how do i resolve it

 

 

<?php
    //Get the database connection
    $db = JFactory::getDBO();
  //  if($filter == '');
    $query = "SELECT * FROM `com_versions`";
    $db->setQuery($query);
    $result1 = mysql_query($query);
    print_r ($result1);
    $getPosts = $db->LoadObjectList();
    $i=1;
?>
    <?php do{?>
    <tr>
      <td><?php echo $row_getPosts['i'];?></td>
      <td><?php echo $row_getPosts['id'];?></td>
      <td><?php echo $row_getPosts['client'];?></td>
      <td><?php echo $row_getPosts['url'];?></td>
      <td><?php echo $row_getPosts['software_name'];?></td>
      <td><?php echo $row_getPosts['dom'];?></td>
      <td><?php echo $row_getPosts['present_version'];?></td>
      <td><a href="?cmdEdit&id=<?php echo $row_getPosts['id'];?>">EDIT</a></td>
      <td><a href="?cmdDelete&id=<?php echo $row_getPosts['id'];?>">DELETE</a></td>
    </tr>
     <?php } while ($getPosts = mysql_fetch_assoc($query));?>
</table>

Link to comment
Share on other sites

The error is pretty self explanatory. You have passed a string ($query) to mysql_fetch_assoc, it expects a result resource ($result1).

 

Besides that, you should be doing a while loop, not  ado while. Your current approach makes little sense.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.