Jump to content

All I am getting is 'm'


Iryk

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?
Link to comment
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]
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.