Jump to content

Archived

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

Iryk

All I am getting is 'm'

Recommended Posts

[code]<?
$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>";
?>[/code]

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

Share this post


Link to post
Share on other sites
I don't know if this is part of your problem, but I've never seen code like this:
[code]$result = "mysql_query(" . $query . ")";
$get = "mysql_fetch_array(" . $result . ")";[/code]

Try changing that to:
[code]$result = mysql_query($query);
$get = mysql_fetch_array($result);[/code]

Share this post


Link to post
Share on other sites

×

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.