Jump to content

error_22

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

error_22's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I have a db table called "catlinks". There are three different columns in there (c_id, c_name, c_url). I also have another table called "sublinks" with the columns: s_id, s_name, s_url, s_cat. I want the values from these tables to show up like this: [code] <table> <tr> <td>Head links</td><td>Sublinks</td> </tr> <tr> <td>headlink#1 (c_name)</td>sublink#1, sublink#2 (s_name with the c_cat value of c_id)</td> </tr> <tr> <td>headlink#2 (c_name)</td>sublink#3, sublink#4 (s_name with the s_cat value of c_id)</td> </tr> etc... </table> [/code] So I tried the following: [code] echo "<table>"; $sql = "SELECT * FROM catlinks l LEFT JOIN sublinks s ON c_id=s_cat ORDER BY c_name, s.s_name"; $result = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_object($result)) { <tr> <td><? echo $row->c_name; ?></td> <td><? echo $row->s_name; ?></td> </tr> } echo "</table>"; [/code] The problem is, when I echo the results, I get this: [img]http://www.octocomnetwork.com/result.png[/img] Any help would be greatly appreciated! Thanks in advance Niklas
×
×
  • 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.