help with very simple php problem...

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

    #1

    help with very simple php problem...

    Hi, I've just started learning some stuff about php and have been
    following a couple of tutorials. At the moment I'm stuck with this small
    piece of code which gives me an error "mysql_fetch_ar ray():supplied
    argument is not a valid MySql result"

    <?php
    include 'config.php';
    include 'opendb.php';

    $query="SELECT cname, csubject, cmessage FROM contact";
    $result=mysql_q uery($query);

    while($row= mysql_fetch_arr ay($result,MYSQ L_ASSOC))
    {
    echo
    "Name :{$row['cname']} <br>" . "Subject : {$row['csubject']} <br>" .
    "Message : {$row['cmessage']} <br><br>";
    }
    include 'closedb.php';
    ?>

    This should just display the content of a table..
    Thanx for your help!
  • max

    #2
    Re: help with very simple php problem...

    max probably wrote the following stuff on 16/07/2005 13.01:[color=blue]
    > This should just display the content of a table..
    > Thanx for your help![/color]

    Nevermind it's all working now, I just messed up with the DB connections
    so it was looking in the wrong place! :-D

    Comment

    • Shelly

      #3
      Re: help with very simple php problem...


      "max" <nospam@nospam. com> wrote in message
      news:BO5Ce.1925 $B6.51988@twist er1.libero.it.. .[color=blue]
      > Hi, I've just started learning some stuff about php and have been
      > following a couple of tutorials. At the moment I'm stuck with this small
      > piece of code which gives me an error "mysql_fetch_ar ray():supplied
      > argument is not a valid MySql result"
      >
      > <?php
      > include 'config.php';
      > include 'opendb.php';
      >
      > $query="SELECT cname, csubject, cmessage FROM contact";
      > $result=mysql_q uery($query);
      >
      > while($row= mysql_fetch_arr ay($result,MYSQ L_ASSOC))
      > {
      > echo
      > "Name :{$row['cname']} <br>" . "Subject : {$row['csubject']} <br>" .
      > "Message : {$row['cmessage']} <br><br>";
      > }
      > include 'closedb.php';
      > ?>
      >
      > This should just display the content of a table..
      > Thanx for your help![/color]

      Could you please show the contents of opendb.php?

      Shelly


      Comment

      • max

        #4
        Re: help with very simple php problem...

        Shelly probably wrote the following stuff on 16/07/2005 13.26:[color=blue]
        > Could you please show the contents of opendb.php?
        >[/color]

        yeah I realized too that the problem was in there...actuall y in the
        config.php since the opendb.php has variables that relate with the
        config file.
        Now everything is ok,
        Thank you!

        Comment

        Working...