Jump to content


Photo

All I am getting is 'm'


  • Please log in to reply
1 reply to this topic

#1 Iryk

Iryk
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 03 June 2006 - 07:07 PM

<?
$query = "SELECT * FROM `topics` WHERE `Category`='$category' ORDER BY `ID` DESC LIMIT 0,30";
$result = "mysql_query(" . $query . ")";
$get = "mysql_fetch_array(" . $result . ")";
$i = 1;
    echo "<table>";
    while($get) {
        $id = $get['ID'];
        $topic = $get['Topic'];
        $author = $get['Author'];
        $date = $get['Date'];
        $replies = mysql_num_rows(mysql_query("SELECT * FROM `replies` WHERE `Topic`='" . $topic . "'"));
            if($i % 2 == "1") {
                $bgcolor = "#E4E4E4"; } else {
                $bgcolor = "#EEEEEE"; }
                echo "<tr bgcolor='" . $bgcolor . "'>";
                echo "<td width='50%'>" . $topic . "</td>";
                echo "<td width='20%'>" . $author . "</td>";
                echo "<td width='20%'>" . $date . "</td>";
                echo "<td width='10%'>" . $replies . "</td>";
                echo "</tr>";
        $i++;
    }
    echo "</table>";
?>

It is only giving the result of m for my values. Can some one please tell me what I am doing wrong?

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 03 June 2006 - 08:09 PM

I don't know if this is part of your problem, but I've never seen code like this:
$result = "mysql_query(" . $query . ")";
$get = "mysql_fetch_array(" . $result . ")";

Try changing that to:
$result = mysql_query($query);
$get = mysql_fetch_array($result);

Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users