What's Wrong with my Script?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • funkychicken818@gmail.com

    What's Wrong with my Script?

    <?php
    include"dbconn. php";
    $db=mysql_selec t_db(creative_A rticles,$connec tion);

    $Parent="SELECT DISTINCT 'Cat_Parent' FROM Category";

    $mysql_Parent=m ysql_query($Par ent);

    while ($row=mysql_fet ch_array($mysql _Parent))
    {
    $Cat_Parent=$ro w["Cat_Parent "];

    echo "$Cat_Paren t";
    }
    ?>

  • Tom Thackrey

    #2
    Re: What's Wrong with my Script?



    On 4-May-2006, "funkychicken81 8@gmail.com" <funkychicken81 8@gmail.com>
    wrote:
    [color=blue]
    > $Parent="SELECT DISTINCT 'Cat_Parent' FROM Category";[/color]

    Looks like the wrong kind of ticks around the column name it should be
    `Cat_Parent`
    --
    Tom Thackrey

    tom (at) creative (dash) light (dot) com
    do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

    Comment

    • Tim Roberts

      #3
      Re: What's Wrong with my Script?

      "funkychicken81 8@gmail.com" <funkychicken81 8@gmail.com> wrote:
      [color=blue]
      ><?php
      > include"dbconn. php";
      > $db=mysql_selec t_db(creative_A rticles,$connec tion);[/color]

      Is creative_Articl es the name of the database? If so then you want it to
      be in quotes.
      [color=blue]
      > $Parent="SELECT DISTINCT 'Cat_Parent' FROM Category";[/color]

      If Cat_Parent is a column name, you probably don't want the single quotes
      in there. You're selecting the constant string "Cat_Parent ", not the
      column named Cat_Parent.
      [color=blue]
      > $mysql_Parent=m ysql_query($Par ent);
      > while ($row=mysql_fet ch_array($mysql _Parent))
      > {
      > $Cat_Parent=$ro w["Cat_Parent "];
      > echo "$Cat_Paren t";
      > }
      > ?>[/color]

      The rest looks OK.
      --
      - Tim Roberts, timr@probo.com
      Providenza & Boekelheide, Inc.

      Comment

      • funkychicken818@gmail.com

        #4
        Re: What's Wrong with my Script?

        thanks i got it to work

        Comment

        Working...