Jump to content

[SOLVED] Not a Unique Table


phpSensei

Recommended Posts

Can someone please tell why this keeps coming up whenever I view one of my forum topics?

 

 

Error: Not unique table/alias: 'forums'

 

 

 

<div align="center">
  <div align="center">
    <table width="57%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td bgcolor="#FFCC99"><div align="left">
          <table width="57%"  border="0" align="center" cellpadding="0" cellspacing="0">
            <tr class="style2">
              <td width="89"><div align="center" class="style3 style4"><strong>Home</strong></div></td>
              <td width="89"><div align="center" class="style6"><a href="user/index.php?mode=signup" class="style6">Register</a></div></td>
              <td width="89"><div align="center" class="style6">Memberlist</div></td>
              <td width="89"><div align="center" class="style6">Search</div></td>
            </tr>
          </table>
        </div></td>
      </tr>
    </table>
    <a href="index.php">Metaldog Forums</a> / <?php 
$id=$_GET['id'];
$mysql= "SELECT * FROM forums WHERE id='$id'";
$result1=mysql_query($mysql);
$result=mysql_fetch_array($result1);
echo $result['forum_name'];
?> <br>
      <table width="57%" border="0" cellpadding="0" cellspacing="3" id="1">
      <tr>
        <td><div align="center" class="style1 style2">
</div></td>
      </tr>
      <tr>
        <td><?php $id=$_GET['id'];
   $result=mysql_query("SELECT * FROM forums INNER JOIN forums ON idtop_msg=id WHERE idtop_msg='$id'") or die('Error: ' . mysql_error());

while($row = mysql_fetch_array($result)){    echo $row['subject_msg'] . '<br>' . '<hr>
';}
?></td>
        </tr>
    </table>
    <p>
<?php

echo $username; ?><br>
      <br>
        <span class="style7"><span class="style1">Powered by <a href="index.php">MetalDog.com</a>&#8482; 2007-2008<br>
      OpenSource Softwares <br>  
        </span><br>
    </span></p>
  </div>

</div>

Link to comment
https://forums.phpfreaks.com/topic/59542-solved-not-a-unique-table/
Share on other sites

i think that is an sql issue may you plss post that code

 

Sorry about that, This is the code without the CSS style and Document Title:

 

<div align="center">
  <div align="center">
    <table width="57%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td bgcolor="#FFCC99"><div align="left">
          <table width="57%"  border="0" align="center" cellpadding="0" cellspacing="0">
            <tr class="style2">
              <td width="89"><div align="center" class="style3 style4"><strong>Home</strong></div></td>
              <td width="89"><div align="center" class="style6"><a href="user/index.php?mode=signup" class="style6">Register</a></div></td>
              <td width="89"><div align="center" class="style6">Memberlist</div></td>
              <td width="89"><div align="center" class="style6">Search</div></td>
            </tr>
          </table>
        </div></td>
      </tr>
    </table>
    <a href="index.php">Metaldog Forums</a> / <?php 
$id=$_GET['id'];
$mysql= "SELECT * FROM forums WHERE id='$id'";
$result1=mysql_query($mysql);
$result=mysql_fetch_array($result1);
echo $result['forum_name'];
?> <br>
      <table width="57%" border="0" cellpadding="0" cellspacing="3" id="1">
      <tr>
        <td><div align="center" class="style1 style2">
</div></td>
      </tr>
      <tr>
        <td><?php $id=$_GET['id'];
   $result=mysql_query("SELECT * FROM forums INNER JOIN forums ON idtop_msg=id WHERE idtop_msg='$id'") or die('Error: ' . mysql_error());

while($row = mysql_fetch_array($result)){    echo $row['subject_msg'] . '<br>' . '<hr>
';}
?></td>
        </tr>
    </table>
    <p>
<?php

echo $username; ?><br>
      <br>
        <span class="style7"><span class="style1">Powered by <a href="index.php">MetalDog.com</a>&#8482; 2007-2008<br>
      OpenSource Softwares <br>  
        </span><br>
    </span></p>
  </div>

</div>

got cha

SELECT * FROM forums INNER JOIN forums ON idtop_msg=id WHERE idtop_msg='$id'

 

you are joining forum from forum that should another table

 

THANKYOU again...

 

Now when I click the Forum Name it takes me to the page and displays all the records by pagination, and shows the user what page they are on.

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.