multiple lin

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

    multiple lin

    hallow

    how can i add lines into my page

    for example
    i have this line

    ..download january

    but in my database are more downloads called january.
    i have the function to fugure out how much lines there are in my db,
    but how can i echo them as much there are lines in my db

    thanks

    maarten


  • Daniel Tryba

    #2
    Re: multiple lin

    Gurk <gurkjaan@hotma il.com> wrote:[color=blue]
    > how can i add lines into my page
    >
    > for example
    > i have this line
    >
    > .download january
    >
    > but in my database are more downloads called january.
    > i have the function to fugure out how much lines there are in my db,
    > but how can i echo them as much there are lines in my db[/color]

    Huh? Is your question how to read all rows from a database query?

    Fetch a result row as an associative array, a numeric array, or both


    Example 2. mysql_fetch_arr ay() with MYSQL_NUM
    <?php
    mysql_connect(" localhost", "mysql_user ", "mysql_password ") or
    die("Could not connect: " . mysql_error());
    mysql_select_db ("mydb");

    $result = mysql_query("SE LECT id, name FROM mytable");

    while ($row = mysql_fetch_arr ay($result, MYSQL_NUM)) {
    printf("ID: %s Name: %s", $row[0], $row[1]);
    }

    mysql_free_resu lt($result);
    ?>

    Much depends on the actual database used.

    --

    Daniel Tryba

    Comment

    • Gurk

      #3
      Re: multiple lin

      tkank jou verry much

      kind regards Maarten


      "Daniel Tryba" <news_comp.lang .php@canopus.nl > wrote in message
      news:chacm2$rkd $2@news.tue.nl. ..[color=blue]
      > Gurk <gurkjaan@hotma il.com> wrote:[color=green]
      >> how can i add lines into my page
      >>
      >> for example
      >> i have this line
      >>
      >> .download january
      >>
      >> but in my database are more downloads called january.
      >> i have the function to fugure out how much lines there are in my db,
      >> but how can i echo them as much there are lines in my db[/color]
      >
      > Huh? Is your question how to read all rows from a database query?
      >
      > http://www.php.net/manual/en/functio...etch-array.php
      >
      > Example 2. mysql_fetch_arr ay() with MYSQL_NUM
      > <?php
      > mysql_connect(" localhost", "mysql_user ", "mysql_password ") or
      > die("Could not connect: " . mysql_error());
      > mysql_select_db ("mydb");
      >
      > $result = mysql_query("SE LECT id, name FROM mytable");
      >
      > while ($row = mysql_fetch_arr ay($result, MYSQL_NUM)) {
      > printf("ID: %s Name: %s", $row[0], $row[1]);
      > }
      >
      > mysql_free_resu lt($result);
      > ?>
      >
      > Much depends on the actual database used.
      >
      > --
      >
      > Daniel Tryba
      >[/color]


      Comment

      • Gurk

        #4
        Re: multiple lin

        thanks for the code, it works but it wont display the first value of the db.

        can someone give me an explenation of this code, so i can figure out what's
        wrong.

        thanks Maarten

        "Gurk" <gurkjaan@hotma il.com> wrote in message
        news:4138b9a1$0 $3560$ba620e4c@ news.skynet.be. ..[color=blue]
        > tkank jou verry much
        >
        > kind regards Maarten
        >
        >
        > "Daniel Tryba" <news_comp.lang .php@canopus.nl > wrote in message
        > news:chacm2$rkd $2@news.tue.nl. ..[color=green]
        >> Gurk <gurkjaan@hotma il.com> wrote:[color=darkred]
        >>> how can i add lines into my page
        >>>
        >>> for example
        >>> i have this line
        >>>
        >>> .download january
        >>>
        >>> but in my database are more downloads called january.
        >>> i have the function to fugure out how much lines there are in my db,
        >>> but how can i echo them as much there are lines in my db[/color]
        >>
        >> Huh? Is your question how to read all rows from a database query?
        >>
        >> http://www.php.net/manual/en/functio...etch-array.php
        >>
        >> Example 2. mysql_fetch_arr ay() with MYSQL_NUM
        >> <?php
        >> mysql_connect(" localhost", "mysql_user ", "mysql_password ") or
        >> die("Could not connect: " . mysql_error());
        >> mysql_select_db ("mydb");
        >>
        >> $result = mysql_query("SE LECT id, name FROM mytable");
        >>
        >> while ($row = mysql_fetch_arr ay($result, MYSQL_NUM)) {
        >> printf("ID: %s Name: %s", $row[0], $row[1]);
        >> }
        >>
        >> mysql_free_resu lt($result);
        >> ?>
        >>
        >> Much depends on the actual database used.
        >>
        >> --
        >>
        >> Daniel Tryba
        >>[/color]
        >
        >[/color]


        Comment

        Working...