Problem with my SELECT

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bokke

    Problem with my SELECT

    Hi,

    I have a page with a link

    <a href="Contribut or.php?action=& SubCat=<?php echo $row["writer"];
    ?>"><?php echo $row["writer"];?></a>

    that does to a page with a SELECT

    $query = "SELECT * FROM news WHERE writer='$SubCat ' ";

    But it is not pulling any data from the database. If I do this
    $query = "SELECT * FROM news WHERE writer='Bob Smith' ";
    works great??

    also
    the ULR reads -
    Contributor.php ?action=&SubCat =Bob%20Smith
    so I know the link is correct ....

    but for the life of me I can't figure out whats wrong with the SELECT
    statement?

    If anyone can help me with this I would be forever in your Debt.

    Thanks

    here is the complete Contributor.php script.

    <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!--
    #BeginTemplate "/Templates/journ.dwt" -->
    <head>
    <meta http-equiv="content-type" content="text/html;
    charset=ISO-8859-1" />
    <!-- #BeginEditable "doctitle" -->
    <title>paper</title>
    <!-- #EndEditable -->
    <link rel="stylesheet " href="Styles/template.css" type="text/css" />
    </head>
    <body>

    <div id="container" >
    <div id="logo"><img src="Images/logo.jpg" border="0"
    alt="logo"></div>
    <div id=bar><form action="a.php" method="POST">
    <label for="searchtxt" >Search our archives:</label>
    <input id="searchtxt" type="text" name="searchtxt " value="" />
    <input class="button" type="submit" value="Search" /></form>
    </div>
    <div id="header">
    <!-- #BeginEditable "Adds" --><div
    id="athlete"><i mg
    src="../Images/Athlete.gif" border="0" alt="AthleteMon th">
    <img src="../Images/AthleteMonth.jp g"
    border="0"
    alt="AthleteMon th"><br>
    Susan smith</div>
    <br>
    <? include("Ads.ph p") ?><!--
    #EndEditable -->
    </div>
    <div id="sidebar">

    <div id=writer>Your News</div>
    <div id="navcontaine r">

    <ul id="navlist">
    <table>
    <?
    $query = "SELECT DISTINCT cat FROM news";
    $result = mysql_query($qu ery)
    or die ("no can do.");
    while($row = mysql_fetch_arr ay($result))
    {
    ?>
    <tr>
    <td>
    <li><a href="../<?php echo $row["cat"];?>"><?php echo
    $row["cat"];?></a></li>
    </td>
    </tr>
    <?php
    }
    ?>
    </table>
    ------------------------
    <li><a href="Classifie d.php">Classifi ed Ads</a></li>
    <li><a href="Advertise .php">Advertise With Us</a></li>
    <li><a href="About.php ">About Us</a></li>
    <li><a href="FindUs.ph p">Contact Us</a></li>
    </ul>
    </div>
    <div id=writer>Visit our Sponsor</div>
    <!-- #BeginEditable "Left" -->{Left}<!--
    #EndEditable -->
    </div>
    <!-- #BeginEditable "middle" -->
    <!--
    -----------------------------------------NEWS-------------------------------------------------------------
    -->
    <div id="content">
    <div id="bodymenu">N ews</div>
    <table>
    <?
    $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
    $result = mysql_query($qu ery)
    or die ("no can do.");
    while($row = mysql_fetch_arr ay($result))
    {
    ?>
    <tr>
    <td>
    <div id="bodyhead">< ?php echo $row["heading"];?></div>
    </td>
    <td>
    Issue: <a href="#"><?php echo $row["date"];?></a>
    </td>
    </tr>
    <tr>
    </tr>
    <tr>
    <td colspan=2>
    <div id=bodywords>
    <?php
    $abc = ($row["article"]);
    $abc=substr($ab c,0,400);
    echo $abc;
    ?>
    ......<span class="class1"> <a href="#">Read the article</a></span>
    </div>
    </td>
    </tr>
    <?php
    }
    ?>
    </table>
    </div>
    <!-- #EndEditable --</div>

    </body>
    <!-- #EndTemplate --></html>

  • Jay

    #2
    Re: Problem with my SELECT

    " . $_GET["SubCat"] . "

    bokke wrote:
    Hi,
    >
    I have a page with a link
    >
    <a href="Contribut or.php?action=& SubCat=<?php echo $row["writer"];
    ?>"><?php echo $row["writer"];?></a>
    >
    that does to a page with a SELECT
    >
    $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
    >
    But it is not pulling any data from the database. If I do this
    $query = "SELECT * FROM news WHERE writer='Bob Smith' ";
    works great??
    >
    also
    the ULR reads -
    Contributor.php ?action=&SubCat =Bob%20Smith
    so I know the link is correct ....
    >
    but for the life of me I can't figure out whats wrong with the SELECT
    statement?
    >
    If anyone can help me with this I would be forever in your Debt.
    >
    Thanks
    >
    here is the complete Contributor.php script.
    >
    <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!--
    #BeginTemplate "/Templates/journ.dwt" -->
    <head>
    <meta http-equiv="content-type" content="text/html;
    charset=ISO-8859-1" />
    <!-- #BeginEditable "doctitle" -->
    <title>paper</title>
    <!-- #EndEditable -->
    <link rel="stylesheet " href="Styles/template.css" type="text/css" />
    </head>
    <body>
    >
    <div id="container" >
    <div id="logo"><img src="Images/logo.jpg" border="0"
    alt="logo"></div>
    <div id=bar><form action="a.php" method="POST">
    <label for="searchtxt" >Search our archives:</label>
    <input id="searchtxt" type="text" name="searchtxt " value="" />
    <input class="button" type="submit" value="Search" /></form>
    </div>
    <div id="header">
    <!-- #BeginEditable "Adds" --><div
    id="athlete"><i mg
    src="../Images/Athlete.gif" border="0" alt="AthleteMon th">
    <img src="../Images/AthleteMonth.jp g"
    border="0"
    alt="AthleteMon th"><br>
    Susan smith</div>
    <br>
    <? include("Ads.ph p") ?><!--
    #EndEditable -->
    </div>
    <div id="sidebar">
    >
    <div id=writer>Your News</div>
    <div id="navcontaine r">
    >
    <ul id="navlist">
    <table>
    <?
    $query = "SELECT DISTINCT cat FROM news";
    $result = mysql_query($qu ery)
    or die ("no can do.");
    while($row = mysql_fetch_arr ay($result))
    {
    ?>
    <tr>
    <td>
    <li><a href="../<?php echo $row["cat"];?>"><?php echo
    $row["cat"];?></a></li>
    </td>
    </tr>
    <?php
    }
    ?>
    </table>
    ------------------------
    <li><a href="Classifie d.php">Classifi ed Ads</a></li>
    <li><a href="Advertise .php">Advertise With Us</a></li>
    <li><a href="About.php ">About Us</a></li>
    <li><a href="FindUs.ph p">Contact Us</a></li>
    </ul>
    </div>
    <div id=writer>Visit our Sponsor</div>
    <!-- #BeginEditable "Left" -->{Left}<!--
    #EndEditable -->
    </div>
    <!-- #BeginEditable "middle" -->
    <!--
    -----------------------------------------NEWS-------------------------------------------------------------
    -->
    <div id="content">
    <div id="bodymenu">N ews</div>
    <table>
    <?
    $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
    $result = mysql_query($qu ery)
    or die ("no can do.");
    while($row = mysql_fetch_arr ay($result))
    {
    ?>
    <tr>
    <td>
    <div id="bodyhead">< ?php echo $row["heading"];?></div>
    </td>
    <td>
    Issue: <a href="#"><?php echo $row["date"];?></a>
    </td>
    </tr>
    <tr>
    </tr>
    <tr>
    <td colspan=2>
    <div id=bodywords>
    <?php
    $abc = ($row["article"]);
    $abc=substr($ab c,0,400);
    echo $abc;
    ?>
    .....<span class="class1"> <a href="#">Read the article</a></span>
    </div>
    </td>
    </tr>
    <?php
    }
    ?>
    </table>
    </div>
    <!-- #EndEditable --</div>
    >
    </body>
    <!-- #EndTemplate --></html>

    Comment

    • bokke

      #3
      Re: Problem with my SELECT

      hi Jay,

      $query = "SELECT * FROM news WHERE writer=" . $_GET["SubCat"] . "";
      $result = mysql_query($qu ery)
      or die ("no can do.");

      gets me a good old "no can do". besides I have these Select scripts
      working on other sites without the GET??

      thanks though

      Jay wrote:
      " . $_GET["SubCat"] . "
      >
      bokke wrote:
      Hi,

      I have a page with a link

      <a href="Contribut or.php?action=& SubCat=<?php echo $row["writer"];
      ?>"><?php echo $row["writer"];?></a>

      that does to a page with a SELECT

      $query = "SELECT * FROM news WHERE writer='$SubCat ' ";

      But it is not pulling any data from the database. If I do this
      $query = "SELECT * FROM news WHERE writer='Bob Smith' ";
      works great??

      also
      the ULR reads -
      Contributor.php ?action=&SubCat =Bob%20Smith
      so I know the link is correct ....

      but for the life of me I can't figure out whats wrong with the SELECT
      statement?

      If anyone can help me with this I would be forever in your Debt.

      Thanks

      here is the complete Contributor.php script.

      <!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!--
      #BeginTemplate "/Templates/journ.dwt" -->
      <head>
      <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1" />
      <!-- #BeginEditable "doctitle" -->
      <title>paper</title>
      <!-- #EndEditable -->
      <link rel="stylesheet " href="Styles/template.css" type="text/css" />
      </head>
      <body>

      <div id="container" >
      <div id="logo"><img src="Images/logo.jpg" border="0"
      alt="logo"></div>
      <div id=bar><form action="a.php" method="POST">
      <label for="searchtxt" >Search our archives:</label>
      <input id="searchtxt" type="text" name="searchtxt " value="" />
      <input class="button" type="submit" value="Search" /></form>
      </div>
      <div id="header">
      <!-- #BeginEditable "Adds" --><div
      id="athlete"><i mg
      src="../Images/Athlete.gif" border="0" alt="AthleteMon th">
      <img src="../Images/AthleteMonth.jp g"
      border="0"
      alt="AthleteMon th"><br>
      Susan smith</div>
      <br>
      <? include("Ads.ph p") ?><!--
      #EndEditable -->
      </div>
      <div id="sidebar">

      <div id=writer>Your News</div>
      <div id="navcontaine r">

      <ul id="navlist">
      <table>
      <?
      $query = "SELECT DISTINCT cat FROM news";
      $result = mysql_query($qu ery)
      or die ("no can do.");
      while($row = mysql_fetch_arr ay($result))
      {
      ?>
      <tr>
      <td>
      <li><a href="../<?php echo $row["cat"];?>"><?php echo
      $row["cat"];?></a></li>
      </td>
      </tr>
      <?php
      }
      ?>
      </table>
      ------------------------
      <li><a href="Classifie d.php">Classifi ed Ads</a></li>
      <li><a href="Advertise .php">Advertise With Us</a></li>
      <li><a href="About.php ">About Us</a></li>
      <li><a href="FindUs.ph p">Contact Us</a></li>
      </ul>
      </div>
      <div id=writer>Visit our Sponsor</div>
      <!-- #BeginEditable "Left" -->{Left}<!--
      #EndEditable -->
      </div>
      <!-- #BeginEditable "middle" -->
      <!--
      -----------------------------------------NEWS-------------------------------------------------------------
      -->
      <div id="content">
      <div id="bodymenu">N ews</div>
      <table>
      <?
      $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
      $result = mysql_query($qu ery)
      or die ("no can do.");
      while($row = mysql_fetch_arr ay($result))
      {
      ?>
      <tr>
      <td>
      <div id="bodyhead">< ?php echo $row["heading"];?></div>
      </td>
      <td>
      Issue: <a href="#"><?php echo $row["date"];?></a>
      </td>
      </tr>
      <tr>
      </tr>
      <tr>
      <td colspan=2>
      <div id=bodywords>
      <?php
      $abc = ($row["article"]);
      $abc=substr($ab c,0,400);
      echo $abc;
      ?>
      .....<span class="class1"> <a href="#">Read the article</a></span>
      </div>
      </td>
      </tr>
      <?php
      }
      ?>
      </table>
      </div>
      <!-- #EndEditable --</div>

      </body>
      <!-- #EndTemplate --></html>

      Comment

      • Rik

        #4
        Re: Problem with my SELECT

        bokke wrote:
        hi Jay,
        >
        $query = "SELECT * FROM news WHERE writer=" . $_GET["SubCat"] . "";
        $result = mysql_query($qu ery)
        or die ("no can do.");
        >
        gets me a good old "no can do". besides I have these Select scripts
        working on other sites without the GET??
        How would $_GET not work on other sites? Or do you mean the variable will
        be fed otherwise?

        In this case, one should offcourse always quote strings. When running into
        trouble, don't blindly post this to a newsgroup/forum, there's othe things
        you can check:

        - Offcourse, there's always spelling errors.
        - Echo the query-string, to check wether the query is built correctly
        (which it wasn't in this case).
        - Use backticks around field- and tablenames
        - Echo mysql_error(), and check what it sais.

        Seriously consider putting in the fieldnames instead of SELECT *, check the
        manual why.

        $cat = mysql_real_esca pe_string(trim( $_GET['subcat']));//or any other means
        of getting the value
        $query = "
        SELECT
        *
        FROM
        `news`
        WHERE
        `writer` LIKE '$cat'";

        --
        Rik Wasmus


        Comment

        • bokke

          #5
          Re: Problem with my SELECT

          Hey Rick,

          I have always used
          <a href="Contribut or.php?action=& SubCat=<?php echo $row["writer"];
          ?>"><?php echo $row["writer"];?></a>
          to feed the variable - and then used
          $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
          - I only use POST and GET with forms - not simple links.

          -"quote strings" - not sure which string you would like me to quote?

          -as for
          "- Offcourse, there's always spelling errors.
          - Echo the query-string, to check wether the query is built correctly
          (which it wasn't in this case).
          - Use backticks around field- and tablenames
          - Echo mysql_error(), and check what it sais."
          -Checked the spelling again and again - but thats not it
          -I use or die ("no can do."); so I know when it's not working - in this
          case it works just not reading the variable. Again, if I change the
          WHERE writer='$SubCat ' "; to WHERE writer='Bob Smith' "; it works fine
          ???

          and as for "blindly post this to a newsgroup/forum" man - I am on day
          two of this problem - you can only spell writer so many ways before
          you realize it is not spelling. I think I have exchased all my tricks
          .... it must be a header issue or a .... damn i just don't know?

          thanks for your input though.

          michael

          Rik wrote:
          bokke wrote:
          hi Jay,

          $query = "SELECT * FROM news WHERE writer=" . $_GET["SubCat"] . "";
          $result = mysql_query($qu ery)
          or die ("no can do.");

          gets me a good old "no can do". besides I have these Select scripts
          working on other sites without the GET??
          >
          How would $_GET not work on other sites? Or do you mean the variable will
          be fed otherwise?
          >
          In this case, one should offcourse always quote strings. When running into
          trouble, don't blindly post this to a newsgroup/forum, there's othe things
          you can check:
          >
          - Offcourse, there's always spelling errors.
          - Echo the query-string, to check wether the query is built correctly
          (which it wasn't in this case).
          - Use backticks around field- and tablenames
          - Echo mysql_error(), and check what it sais.
          >
          Seriously consider putting in the fieldnames instead of SELECT *, check the
          manual why.
          >
          $cat = mysql_real_esca pe_string(trim( $_GET['subcat']));//or any other means
          of getting the value
          $query = "
          SELECT
          *
          FROM
          `news`
          WHERE
          `writer` LIKE '$cat'";
          >
          --
          Rik Wasmus

          Comment

          • Rik

            #6
            Re: Problem with my SELECT

            bokke wrote:
            Hey Rick,
            >
            I have always used
            <a href="Contribut or.php?action=& SubCat=<?php echo $row["writer"];
            >"><?php echo $row["writer"];?></a>
            to feed the variable - and then used
            $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
            - I only use POST and GET with forms - not simple links.
            >
            -"quote strings" - not sure which string you would like me to quote?
            >
            -as for
            "- Offcourse, there's always spelling errors.
            >- Echo the query-string, to check wether the query is built correctly
            >(which it wasn't in this case).
            >- Use backticks around field- and tablenames
            >- Echo mysql_error(), and check what it sais."
            >
            -Checked the spelling again and again - but thats not it
            -I use or die ("no can do."); so I know when it's not working - in
            this
            case it works just not reading the variable. Again, if I change the
            WHERE writer='$SubCat ' "; to WHERE writer='Bob Smith' "; it works
            fine ???
            >
            and as for "blindly post this to a newsgroup/forum" man - I am on day
            two of this problem - you can only spell writer so many ways before
            you realize it is not spelling. I think I have exchased all my tricks
            ... it must be a header issue or a .... damn i just don't know?
            >

            Well, it would help a lot if you:
            echo $query;
            echo mysql_error();

            And come back to us with that.
            An or die() construct is fine, but if something indeed goes wrong, one
            would like to know what, not just 'something'. You could temporarily make
            it or die(mysql_error ()); (do not do this on production servers...).
            --
            Rik Wasmus


            Comment

            • Jay

              #7
              Re: Problem with my SELECT

              You didn't put it between single quotes!

              query = "SELECT * FROM news WHERE writer= '" . $_GET["SubCat"] . "' ";

              make sure to validate that variable too.

              bokke wrote:
              Hey Rick,
              >
              I have always used
              <a href="Contribut or.php?action=& SubCat=<?php echo $row["writer"];
              ?>"><?php echo $row["writer"];?></a>
              to feed the variable - and then used
              $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
              - I only use POST and GET with forms - not simple links.
              >
              -"quote strings" - not sure which string you would like me to quote?
              >
              -as for
              "- Offcourse, there's always spelling errors.
              - Echo the query-string, to check wether the query is built correctly
              (which it wasn't in this case).
              - Use backticks around field- and tablenames
              - Echo mysql_error(), and check what it sais."
              >
              -Checked the spelling again and again - but thats not it
              -I use or die ("no can do."); so I know when it's not working - in this
              case it works just not reading the variable. Again, if I change the
              WHERE writer='$SubCat ' "; to WHERE writer='Bob Smith' "; it works fine
              ???
              >
              and as for "blindly post this to a newsgroup/forum" man - I am on day
              two of this problem - you can only spell writer so many ways before
              you realize it is not spelling. I think I have exchased all my tricks
              ... it must be a header issue or a .... damn i just don't know?
              >
              thanks for your input though.
              >
              michael
              >
              Rik wrote:
              bokke wrote:
              hi Jay,
              >
              $query = "SELECT * FROM news WHERE writer=" . $_GET["SubCat"] . "";
              $result = mysql_query($qu ery)
              or die ("no can do.");
              >
              gets me a good old "no can do". besides I have these Select scripts
              working on other sites without the GET??
              How would $_GET not work on other sites? Or do you mean the variable will
              be fed otherwise?

              In this case, one should offcourse always quote strings. When running into
              trouble, don't blindly post this to a newsgroup/forum, there's othe things
              you can check:

              - Offcourse, there's always spelling errors.
              - Echo the query-string, to check wether the query is built correctly
              (which it wasn't in this case).
              - Use backticks around field- and tablenames
              - Echo mysql_error(), and check what it sais.

              Seriously consider putting in the fieldnames instead of SELECT *, check the
              manual why.

              $cat = mysql_real_esca pe_string(trim( $_GET['subcat']));//or any other means
              of getting the value
              $query = "
              SELECT
              *
              FROM
              `news`
              WHERE
              `writer` LIKE '$cat'";

              --
              Rik Wasmus

              Comment

              • bokke

                #8
                Re: Problem with my SELECT

                Sorry Rick where in the code would I echo the $query - and i'll give it
                a go?
                Rik wrote:
                bokke wrote:
                Hey Rick,

                I have always used
                <a href="Contribut or.php?action=& SubCat=<?php echo $row["writer"];
                "><?php echo $row["writer"];?></a>
                to feed the variable - and then used
                $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
                - I only use POST and GET with forms - not simple links.

                -"quote strings" - not sure which string you would like me to quote?

                -as for
                "- Offcourse, there's always spelling errors.
                - Echo the query-string, to check wether the query is built correctly
                (which it wasn't in this case).
                - Use backticks around field- and tablenames
                - Echo mysql_error(), and check what it sais."
                -Checked the spelling again and again - but thats not it
                -I use or die ("no can do."); so I know when it's not working - in
                this
                case it works just not reading the variable. Again, if I change the
                WHERE writer='$SubCat ' "; to WHERE writer='Bob Smith' "; it works
                fine ???

                and as for "blindly post this to a newsgroup/forum" man - I am on day
                two of this problem - you can only spell writer so many ways before
                you realize it is not spelling. I think I have exchased all my tricks
                ... it must be a header issue or a .... damn i just don't know?
                >
                >
                Well, it would help a lot if you:
                echo $query;
                echo mysql_error();
                >
                And come back to us with that.
                An or die() construct is fine, but if something indeed goes wrong, one
                would like to know what, not just 'something'. You could temporarily make
                it or die(mysql_error ()); (do not do this on production servers...).
                --
                Rik Wasmus

                Comment

                • Rik

                  #9
                  Re: Problem with my SELECT

                  bokke wrote:
                  Sorry Rick where in the code would I echo the $query - and i'll give
                  it
                  a go?
                  Please stop topposting, a reply should be below a (trimmed down) quote).

                  But here:



                  --
                  Rik Wasmus


                  Comment

                  • Rik

                    #10
                    Re: Problem with my SELECT

                    Rik wrote:
                    bokke wrote:
                    >Sorry Rick where in the code would I echo the $query - and i'll give
                    >it
                    >a go?
                    >
                    Please stop topposting, a reply should be below a (trimmed down)
                    quote).
                    >
                    But here:
                    D'oh. ctrl-c/ctrl-s switch error :-)

                    $query = "SELECT * FROM news WHERE
                    writer='".mysql _real_escape_st ring($_GET["SubCat"])."'";
                    echo $query;
                    $result = mysql_query($qu ery) or die (mysql_error()) ;
                    --
                    Rik Wasmus


                    Comment

                    • bokke

                      #11
                      Re: Problem with my SELECT

                      Jeasus - I hope I'm not Top Posting and I have deleted the above post
                      all together ....

                      anyway - here is what it spits at me

                      Parse error: syntax error, unexpected '}' in
                      /home/journ6/public_html/Contributor.php on line 102

                      Comment

                      • Rik

                        #12
                        Re: Problem with my SELECT

                        bokke wrote:
                        Jeasus - I hope I'm not Top Posting and I have deleted the above post
                        all together ....
                        Well, that's a way to do it, normally you keep the relevant parts of the
                        previous post in your reply. Remember this is usenet: others my not see a
                        previous post, which could arrive later or not at all, and could still be
                        interested to know what the conversation is about.
                        anyway - here is what it spits at me
                        >
                        Parse error: syntax error, unexpected '}' in
                        /home/journ6/public_html/Contributor.php on line 102

                        Well, that's not related to it, as this is a parse error.
                        Check your php code, the '}' is not in my snippit....

                        --
                        Rik Wasmus


                        Comment

                        • bokke

                          #13
                          Re: Problem with my SELECT

                          Rick you genius ---- aftre 2 days - 40 coffees - I am left with this!

                          <?
                          $query = "SELECT * FROM news WHERE
                          writer='".mysql _real_escape_st ring($_GET["SubCat"])."'";
                          $result = mysql_query($qu ery)
                          or die ("no can do.");
                          while($row = mysql_fetch_arr ay($result))
                          {
                          ?>

                          works like a charm!!!!!!

                          used to have this

                          $query = "SELECT * FROM news WHERE writer='$SubCat ' ";
                          $result = mysql_query($qu ery)
                          or die ("no can do.");
                          while($row = mysql_fetch_arr ay($result))
                          {

                          Thanks man - thank you - sorry about the topposting et all

                          Comment

                          Working...