array / mysql question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martien van Wanrooij

    array / mysql question

    I have been using for a while a class to create photo albums. Shortly, an
    array of photo's is declared, initially they are shown as thumbnails, by
    clicking on a thumbnail a larger photo is shown and there are links to the
    thumbnail list but also to the previous and next photo as the function
    remembers which position the photo has got in the array.
    Now I tried to do the same thing by retrieving photos from a mysql database
    (which is much practical) by searching for filenames that start with a
    certain string. It still works but curiously enough the reference to the
    next and previous photo fails. Also the indicator "foto 1 van 10", "foto 2
    van 10" doesn't work correctly in this variant.
    I am not completely sure the error is in one of these functions but I guess
    it must have to do with it

    This is the code for the array, I used it at

    function addThumbnails()//create an array of files to add {
    $numargs = func_num_args() ;
    $arg_list = func_get_args() ;
    //$teller = 0;
    for ($i = 0; $i < $numargs; $i++)
    {
    $this->foto_array[] = $arg_list[$i];
    //$teller++;
    }
    }

    //calling the class
    $f = new fotoAlbum();
    $f->addThumbnails( "foto1.php","fo to2.php",...)

    Now the database code I used for


    function getFromMySql($b estandspatroon)
    {
    $this->mysql = true;
    $lengte = strlen($bestand spatroon);
    $db = mysql_connect(" servername", "login","passwo rd");
    mysql_select_db ("database",$db ) or die ("FOUT: OPENEN
    DATABASE MISLUKT");
    $query = mysql_query("SE LECT bestandsnaam from fotos where
    LEFT(bestandsna am, $lengte)='$best andspatroon' order by bestandsnaam ASC",
    $db);
    while (list($bestands naam) = mysql_fetch_row ($query))
    {
    $this->foto_array[] = $bestandsnaam;
    }
    mysql_close($db );
    }

    //calling the class
    $f = new fotoAlbum();
    $f->getFromMySql(" ceci2k6")

    As you can see on the pages, both pages load a list of thumbnail but the
    latter only allows navigation by going to the thumbnail page, not to the
    previous or next pages.

    Thanks for any suggestions,

    Martien,

  • Martien van Wanrooij

    #2
    Re: array / mysql question

    sorry I forgot to remove the expression $this->mysql = true; it was only
    there for testing purposes.





    Comment

    • Jerry Stuckle

      #3
      Re: array / mysql question

      Martien van Wanrooij wrote:
      I have been using for a while a class to create photo albums. Shortly,
      an array of photo's is declared, initially they are shown as thumbnails,
      by clicking on a thumbnail a larger photo is shown and there are links
      to the thumbnail list but also to the previous and next photo as the
      function remembers which position the photo has got in the array.
      Now I tried to do the same thing by retrieving photos from a mysql
      database (which is much practical) by searching for filenames that start
      with a certain string. It still works but curiously enough the reference
      to the next and previous photo fails. Also the indicator "foto 1 van
      10", "foto 2 van 10" doesn't work correctly in this variant.
      I am not completely sure the error is in one of these functions but I
      guess it must have to do with it
      >
      This is the code for the array, I used it at

      function addThumbnails()//create an array of files to add {
      $numargs = func_num_args() ;
      $arg_list = func_get_args() ;
      //$teller = 0;
      for ($i = 0; $i < $numargs; $i++)
      {
      $this->foto_array[] = $arg_list[$i];
      //$teller++;
      }
      }
      >
      //calling the class
      $f = new fotoAlbum();
      $f->addThumbnails( "foto1.php","fo to2.php",...)
      >

      I guess, but awfully hard to understand. A much easier way would be:

      function addThumbnails($ tn) {
      if (isarray($tn)
      for each($tn as $t)
      $this->foto_array[]= $t;
      else
      $this->foto_array[] = $tn;
      }

      // calling the classs
      $f = new fotoAlbum();
      $f->addThumbnails( array('foto1.ph p', 'foto2.php' ...));

      Arrays work well
      Now the database code I used for

      >
      function getFromMySql($b estandspatroon)
      {
      $this->mysql = true;
      $lengte = strlen($bestand spatroon);
      $db = mysql_connect(" servername", "login","passwo rd");
      mysql_select_db ("database",$db ) or die ("FOUT: OPENEN
      DATABASE MISLUKT");
      $query = mysql_query("SE LECT bestandsnaam from fotos
      where LEFT(bestandsna am, $lengte)='$best andspatroon' order by
      bestandsnaam ASC", $db);
      while (list($bestands naam) = mysql_fetch_row ($query))
      {
      $this->foto_array[] = $bestandsnaam;
      }
      mysql_close($db );
      }
      >
      //calling the class
      $f = new fotoAlbum();
      $f->getFromMySql(" ceci2k6")
      >
      How many entries do you have in your table which start with 'ceci2k6'?
      And what is in your array after the MySQL call?

      P.S. This is much easier and probably faster:

      $query = mysql_query("SE LECT bestandsnaam from fotos
      where bestandsnaam LIKE '{$bestandspatr oon}% order by
      bestandsnaam ASC", $db);


      As you can see on the pages, both pages load a list of thumbnail but the
      latter only allows navigation by going to the thumbnail page, not to the
      previous or next pages.
      >
      Thanks for any suggestions,
      >
      Martien,

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Martien van Wanrooij

        #4
        Re: array / mysql question


        "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
        news:4O-dnfkY88BOnezYnZ 2dnUVZ_r2dnZ2d@ comcast.com...
        How many entries do you have in your table which start with 'ceci2k6'?
        There are 10 entries in it.
        Thank you for the other improvement suggestions, the "like" statement in
        mysql works fine
        Unfortunately the isArray() you suggested for addThumbnails - also tried
        isarray() - is rejected as a call to an undefined function although it was
        introduced in php 5.1 and the php version is 5.2.0


        Comment

        • Jerry Stuckle

          #5
          Re: array / mysql question

          Martien van Wanrooij wrote:
          >
          "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
          news:4O-dnfkY88BOnezYnZ 2dnUVZ_r2dnZ2d@ comcast.com...
          >
          >How many entries do you have in your table which start with 'ceci2k6'?
          >
          There are 10 entries in it.
          Thank you for the other improvement suggestions, the "like" statement in
          mysql works fine
          Unfortunately the isArray() you suggested for addThumbnails - also
          tried isarray() - is rejected as a call to an undefined function
          although it was introduced in php 5.1 and the php version is 5.2.0
          >
          >
          Sorry, it's is_array() - see the manual.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Martien van Wanrooij

            #6
            Re: array / mysql question


            "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
            news:7YCdnX704d SOEOzYnZ2dnUVZ_ rCdnZ2d@comcast .com...
            Sorry, it's is_array() - see the manual.
            Thanks again for the additional info and you are right, this improvement
            works properly. Unfortunately it still doesn't resolve the original problem
            I posted but this feedback for other improvements is equally welcome :)

            Comment

            • Jerry Stuckle

              #7
              Re: array / mysql question

              Martien van Wanrooij wrote:
              >
              "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
              news:7YCdnX704d SOEOzYnZ2dnUVZ_ rCdnZ2d@comcast .com...
              >
              >Sorry, it's is_array() - see the manual.
              >
              Thanks again for the additional info and you are right, this improvement
              works properly. Unfortunately it still doesn't resolve the original
              problem I posted but this feedback for other improvements is equally
              welcome :)
              >
              That's because you still haven't answered the question - what's in
              foto_array after it has been populated?

              Of course there are a lot of other possibilities which we can't discuss
              because you didn't post the code you use for going to the next (or
              previous) picture, you haven't told us how you get the list of pictures
              on the next page (i.e. do you save data in the session or requery the
              database?).

              Sorry, my crystal ball isn't working tonight. I can't do much without
              sufficient information. :-)

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Martien van Wanrooij

                #8
                Re: array / mysql question


                "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                news:GvmdnUVc-IGe1e_YnZ2dnUVZ _rCdnZ2d@comcas t.com...
                That's because you still haven't answered the question - what's in
                foto_array after it has been populated?
                >
                Jerry first of all thanks for helping me so much. Anyway in both cases, both
                with getFromMySql and with the addThumbnails functions the array is
                populated with photos like like ceci2k600.jpg, ceci2k601.jpg etc.(I hope I
                understood your question correctly) thats why the function toonoverzicht
                works correctly in both cases. But as I said, with the getFromMySql
                function some info is lost when one photo is shown. In my first posting I
                didn't want to post a too large piece of code but now I think it is better
                to post it completely. I have tried to make it as modular as possible but I
                must admit I am not completely successfull in it. All kind of suggestions
                are welcome of course :)

                <?php class fotoAlbum
                {
                var $tmPrefix;//thumbnail prefix, by default it is q, I create my
                thumbnails with irfanview but I am considering the gdi functions later
                var $fotoPagina;//page that contains the script, default is
                toonfoto.php
                var $toevoeging;
                var $foto_array = array();
                var $dezePagina;
                var $mysql = false; //only used to put an apology online, to show
                that there are some errors on it
                function __construct($tm Prefix="q", $fotoPagina =
                "toonfoto.php", $toevoeging ="")
                {
                $this->tmPrefix = $tmPrefix;
                $this->fotoPagina = $fotoPagina;
                $this->toevoeging = $toevoeging;
                }
                function getFromMySql($b estandspatroon)
                {
                $this->mysql = true;
                $db = mysql_connect(" server", "login","passwo rd");
                mysql_select_db ("database",$db ) or die ("FOUT: OPENEN
                DATABASE MISLUKT");
                $query = mysql_query("SE LECT bestandsnaam from fotos where
                bestandsnaam LIKE '{$bestandspatr oon}%' order by bestandsnaam ASC",
                $db);
                while (list($bestands naam) = mysql_fetch_row ($query))
                {
                $this->foto_array[] = $bestandsnaam;
                }
                mysql_close($db );
                }

                function addThumbnails($ tn)
                {
                if (is_array($tn))
                {
                foreach($tn as $t)
                {
                $this->foto_array[]= $t;
                }
                }
                else
                {
                $this->foto_array[] = $tn;
                }
                }

                function arrayposition($ haystack, $needle)//php seems not ta have a
                standard function to do this, suggestions for improvement are welcome of
                course
                {
                $getal = 0;
                $lengte = count($haystack );
                for ($i = 0; $i < $lengte; $i++)
                {
                if ($needle == $haystack[$i])
                {
                return $i;
                }
                }
                return -1;

                }

                function toonOverzicht($ kolommen, $cssClass = "thumb")/* show the
                thumbnails, this one works correctly */
                { if($this->mysql){
                ?>
                <p class= "krktitel" style =
                "background-color:yellow">< marquee>Momente el zijn wij bezig met een aantal
                technische aanpassingen aan onze fotopagina's. Mogelijk werken deze pagina's
                daarom niet geheel correct. Onze excuses voor het ongemak.</marquee></p>
                <?php }
                $this->dezePagina = $_SERVER['PHP_SELF'];
                $teller = 0;
                $lengte = count($this->foto_array);
                print "<table width = \"600\"><tr> ";
                foreach($this->foto_array as $plaatje)
                {
                print "<td class = \"$cssClass\ " align =
                \"center\">< a href =\"$this->dezePagina?pla atje=$plaatje\" ><img src =
                \"$this->tmPrefix$plaat je\" align = \"center\"></a></td>\n";
                $teller++;
                if ($teller % $kolommen == 0 )
                {
                echo"</tr>\n";
                if ($teller < $lengte) echo "<tr>";
                }

                }
                while($teller % $kolommen 0)
                {
                echo"<td class = \"$cssClass\ "></td>";
                $teller++;
                }

                echo "</tr></table>";
                }
                function toonEenFoto($fo to)
                {
                $this->dezePagina = $_SERVER['PHP_SELF'];
                $totaalFotos = count($this->foto_array);
                $hoeveelste = $this->arrayposition( $this->foto_array, $foto)
                + 1;
                //$hoeveelste = array_search($f oto, $this->foto_array);
                echo "<span style =
                \"color:#990000 ;font-size:smaller\"; >Foto $hoeveelste van
                $totaalFotos</span><br>";
                $volgendeFoto = "";
                $vorigeFoto = "";

                /*previous picture*/
                if ($hoeveelste 1)
                {
                $vorigeFoto = $this->foto_array[$hoeveelste - 2];
                $verwijzing = "<a href = \"$this->dezePagina";
                $verwijzing .= "?plaatje=$vori geFoto\"";
                $verwijzing .= "<< Vorige << </a>";
                echo $verwijzing;
                }
                else echo "<span style = \"color:lightgr ey\"<< Vorige <<
                </span>";
                /* thumbnail page */
                echo "&nbsp;&nbsp;&n bsp;-&nbsp;&nbsp;&nb sp;<a href =
                \"$this->dezePagina\">T erug naar het
                overzicht</a>&nbsp;&nbsp;& nbsp;-&nbsp;&nbsp;&nb sp;";
                /* next picture*/
                if ($hoeveelste < $totaalFotos)
                {
                $volgendeFoto = $this->foto_array[$hoeveelste];
                $verwijzing = "<a href = \"$this->dezePagina";
                $verwijzing .= "?plaatje=$volg endeFoto\"";
                $verwijzing .= "Volgende ></a>";
                echo $verwijzing;
                }
                else echo "<span style = \"color:lightgr ey\"Volgende >>
                </span>";
                echo "<p style = \"text-align:center;wi dth:600px\"><im g src
                = \"$foto\"></p>";

                }
                /* check whether the thumbnails have to be shown or only one picture */
                function swapDisplay($ko lommen)
                {
                $plaatje = $_GET['plaatje'];
                if (isset($plaatje )&&file_exists( $plaatje))
                {
                $this->toonEenFoto($p laatje);
                }
                else
                {
                $this->toonOverzicht( $kolommen);
                }
                }




                }
                ?>

                Comment

                • Jerry Stuckle

                  #9
                  Re: array / mysql question

                  Martien van Wanrooij wrote:
                  >
                  "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                  news:GvmdnUVc-IGe1e_YnZ2dnUVZ _rCdnZ2d@comcas t.com...
                  >
                  >That's because you still haven't answered the question - what's in
                  >foto_array after it has been populated?
                  >>
                  Jerry first of all thanks for helping me so much. Anyway in both cases,
                  both with getFromMySql and with the addThumbnails functions the array
                  is populated with photos like like ceci2k600.jpg, ceci2k601.jpg etc.(I
                  hope I understood your question correctly) thats why the function
                  toonoverzicht works correctly in both cases. But as I said, with the
                  getFromMySql function some info is lost when one photo is shown. In my
                  first posting I didn't want to post a too large piece of code but now I
                  think it is better to post it completely. I have tried to make it as
                  modular as possible but I must admit I am not completely successfull in
                  it. All kind of suggestions are welcome of course :)
                  >
                  <?php class fotoAlbum
                  {
                  var $tmPrefix;//thumbnail prefix, by default it is q, I create my
                  thumbnails with irfanview but I am considering the gdi functions later
                  var $fotoPagina;//page that contains the script, default is
                  toonfoto.php
                  var $toevoeging;
                  var $foto_array = array();
                  var $dezePagina;
                  var $mysql = false; //only used to put an apology online, to show
                  that there are some errors on it
                  function __construct($tm Prefix="q", $fotoPagina =
                  "toonfoto.php", $toevoeging ="")
                  {
                  $this->tmPrefix = $tmPrefix;
                  $this->fotoPagina = $fotoPagina;
                  $this->toevoeging = $toevoeging;
                  }
                  function getFromMySql($b estandspatroon)
                  {
                  $this->mysql = true;
                  $db = mysql_connect(" server", "login","passwo rd");
                  mysql_select_db ("database",$db ) or die ("FOUT: OPENEN
                  DATABASE MISLUKT");
                  $query = mysql_query("SE LECT bestandsnaam from fotos
                  where bestandsnaam LIKE '{$bestandspatr oon}%' order by bestandsnaam
                  ASC", $db);
                  while (list($bestands naam) = mysql_fetch_row ($query))
                  {
                  $this->foto_array[] = $bestandsnaam;
                  }
                  mysql_close($db );
                  }
                  >
                  function addThumbnails($ tn)
                  {
                  if (is_array($tn))
                  {
                  foreach($tn as $t)
                  {
                  $this->foto_array[]= $t;
                  }
                  }
                  else
                  {
                  $this->foto_array[] = $tn;
                  }
                  }
                  >
                  function arrayposition($ haystack, $needle)//php seems not ta have
                  a standard function to do this, suggestions for improvement are welcome
                  of course
                  {
                  $getal = 0;
                  $lengte = count($haystack );
                  for ($i = 0; $i < $lengte; $i++)
                  {
                  if ($needle == $haystack[$i])
                  {
                  return $i;
                  }
                  }
                  return -1;
                  >
                  }
                  >
                  function toonOverzicht($ kolommen, $cssClass = "thumb")/* show the
                  thumbnails, this one works correctly */
                  { if($this->mysql){
                  ?>
                  <p class= "krktitel" style =
                  "background-color:yellow">< marquee>Momente el zijn wij bezig met een
                  aantal technische aanpassingen aan onze fotopagina's. Mogelijk werken
                  deze pagina's daarom niet geheel correct. Onze excuses voor het
                  ongemak.</marquee></p>
                  <?php }
                  $this->dezePagina = $_SERVER['PHP_SELF'];
                  $teller = 0;
                  $lengte = count($this->foto_array);
                  print "<table width = \"600\"><tr> ";
                  foreach($this->foto_array as $plaatje)
                  {
                  print "<td class = \"$cssClass\ " align =
                  \"center\">< a href =\"$this->dezePagina?pla atje=$plaatje\" ><img src =
                  \"$this->tmPrefix$plaat je\" align = \"center\"></a></td>\n";
                  $teller++;
                  if ($teller % $kolommen == 0 )
                  {
                  echo"</tr>\n";
                  if ($teller < $lengte) echo "<tr>";
                  }
                  >
                  }
                  while($teller % $kolommen 0)
                  {
                  echo"<td class = \"$cssClass\ "></td>";
                  $teller++;
                  }
                  >
                  echo "</tr></table>";
                  }
                  function toonEenFoto($fo to)
                  {
                  $this->dezePagina = $_SERVER['PHP_SELF'];
                  $totaalFotos = count($this->foto_array);
                  $hoeveelste = $this->arrayposition( $this->foto_array,
                  $foto) + 1;
                  //$hoeveelste = array_search($f oto, $this->foto_array);
                  echo "<span style =
                  \"color:#990000 ;font-size:smaller\"; >Foto $hoeveelste van
                  $totaalFotos</span><br>";
                  $volgendeFoto = "";
                  $vorigeFoto = "";
                  >
                  /*previous picture*/
                  if ($hoeveelste 1)
                  {
                  $vorigeFoto = $this->foto_array[$hoeveelste - 2];
                  $verwijzing = "<a href = \"$this->dezePagina";
                  $verwijzing .= "?plaatje=$vori geFoto\"";
                  $verwijzing .= "<< Vorige << </a>";
                  echo $verwijzing;
                  }
                  else echo "<span style = \"color:lightgr ey\"<< Vorige
                  << </span>";
                  /* thumbnail page */
                  echo "&nbsp;&nbsp;&n bsp;-&nbsp;&nbsp;&nb sp;<a href =
                  \"$this->dezePagina\">T erug naar het
                  overzicht</a>&nbsp;&nbsp;& nbsp;-&nbsp;&nbsp;&nb sp;";
                  /* next picture*/
                  if ($hoeveelste < $totaalFotos)
                  {
                  $volgendeFoto = $this->foto_array[$hoeveelste];
                  $verwijzing = "<a href = \"$this->dezePagina";
                  $verwijzing .= "?plaatje=$volg endeFoto\"";
                  $verwijzing .= "Volgende ></a>";
                  echo $verwijzing;
                  }
                  else echo "<span style = \"color:lightgr ey\"Volgende
                  ></span>";
                  echo "<p style = \"text-align:center;wi dth:600px\"><im g
                  src = \"$foto\"></p>";
                  >
                  }
                  /* check whether the thumbnails have to be shown or only one picture */
                  function swapDisplay($ko lommen)
                  {
                  $plaatje = $_GET['plaatje'];
                  if (isset($plaatje )&&file_exists( $plaatje))
                  {
                  $this->toonEenFoto($p laatje);
                  }
                  else
                  {
                  $this->toonOverzicht( $kolommen);
                  }
                  }
                  >
                  >
                  >
                  >
                  }
                  ?>
                  Hi, Martien,

                  Sorry if my last response sounded a bit abrupt. I just re-read it, and
                  the tone wasn't what I planned. That's what I get for responding when
                  I'm tired :-(.

                  OK, the class itself looks OK, from what I saw (but I didn't go into a
                  lot of depth).

                  OK, you think the class is populated correctly before you display a
                  picture. Have you actually printed out the contents of $foto_array at
                  the end of the getFromMySql() function? I never assume something should
                  be there - I *always* print it out to make sure! :-)

                  And you say when you display the first picture, "some information is
                  being lost". How are you saving the information in the class? Are you
                  putting it in a session, for instance? Or are you pulling the
                  information from the database again? If the latter, again, what are the
                  contents for $foto_array at the end of getFromMySql()?

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • Martien van Wanrooij

                    #10
                    Re: array / mysql question


                    "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                    news:HK6dnelpg8 kFCu7YnZ2dnUVZ_ uqdnZ2d@comcast .com...
                    OK, you think the class is populated correctly before you display a
                    picture. Have you actually printed out the contents of $foto_array at the
                    end of the getFromMySql() function? I never assume something should be
                    there - I *always* print it out to make sure! :-)
                    Well I actually printed it out now just at the end of the getFromMySql()
                    function and curiously enough the whole array is printed. The only thing
                    that not works (when I retrieve the fotos with getFromMySql) is the foto 0
                    van 10 statement which should be foto 1 van 10, foto 2 van 10 and probably
                    for the same reason the reference to the previous foto is grayed out and
                    instead of the next foto a reference to the first one is made.
                    I also stored the array into a session but again without any result
                    BTW the code for instantiating the fotoclass is as follows
                    <?php
                    session_start() ;
                    $title = " - Ceciliaviering 2006"?>
                    <?php include("header .php") ?>
                    <?php include ("fotoclas.php" ) ?>
                    <p class = "krktitel" align = "center">Cecili aviering 2006<p>
                    <DIV STYLE="text-align:center">
                    <?php
                    $f = new fotoAlbum("q"," ceci2k6.php");
                    /*
                    commented out here but this is what works in other pages
                    $f->addThumbnails( array(
                    "ceci2k600.jpg" ,
                    "ceci2k601.jpg" ,
                    "ceci2k602.jpg" ,
                    "ceci2k603.jpg" ,
                    "ceci2k604.jpg" ,
                    "ceci2k605.jpg" ,
                    "ceci2k606.jpg" ,
                    "ceci2k607.jpg" ,
                    "ceci2k608.jpg" ,
                    "ceci2k609. jpg"
                    ));*/
                    $f->getFromMySql(" ceci2k6"); //the function with which I have troubles
                    $f->swapDisplay(4) ;
                    ?></DIV>
                    <?php include ("footer.php ") ?>


                    Comment

                    • Jerry Stuckle

                      #11
                      Re: array / mysql question

                      Martien van Wanrooij wrote:
                      >
                      "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                      news:HK6dnelpg8 kFCu7YnZ2dnUVZ_ uqdnZ2d@comcast .com...
                      >
                      >OK, you think the class is populated correctly before you display a
                      >picture. Have you actually printed out the contents of $foto_array at
                      >the end of the getFromMySql() function? I never assume something
                      >should be there - I *always* print it out to make sure! :-)
                      >
                      Well I actually printed it out now just at the end of the getFromMySql()
                      function and curiously enough the whole array is printed. The only thing
                      that not works (when I retrieve the fotos with getFromMySql) is the foto
                      0 van 10 statement which should be foto 1 van 10, foto 2 van 10 and
                      probably for the same reason the reference to the previous foto is
                      grayed out and instead of the next foto a reference to the first one is
                      made.
                      I also stored the array into a session but again without any result
                      BTW the code for instantiating the fotoclass is as follows
                      <?php
                      session_start() ;
                      $title = " - Ceciliaviering 2006"?>
                      <?php include("header .php") ?>
                      <?php include ("fotoclas.php" ) ?>
                      <p class = "krktitel" align = "center">Cecili aviering 2006<p>
                      <DIV STYLE="text-align:center">
                      <?php
                      $f = new fotoAlbum("q"," ceci2k6.php");
                      /*
                      commented out here but this is what works in other pages
                      $f->addThumbnails( array(
                      "ceci2k600.jpg" ,
                      "ceci2k601.jpg" ,
                      "ceci2k602.jpg" ,
                      "ceci2k603.jpg" ,
                      "ceci2k604.jpg" ,
                      "ceci2k605.jpg" ,
                      "ceci2k606.jpg" ,
                      "ceci2k607.jpg" ,
                      "ceci2k608.jpg" ,
                      "ceci2k609. jpg"
                      ));*/
                      $f->getFromMySql(" ceci2k6"); //the function with which I have troubles
                      $f->swapDisplay(4) ;
                      ?></DIV>
                      <?php include ("footer.php ") ?>
                      >
                      >
                      Martein,

                      OK, I'm just having a little trouble understanding here. After your
                      call to getFromMySql(), does the array actually contain the values

                      "ceci2k600.jpg" ,
                      "ceci2k601.jpg" ,
                      "ceci2k602.jpg" ,
                      "ceci2k603.jpg" ,
                      "ceci2k604.jpg" ,
                      "ceci2k605.jpg" ,
                      "ceci2k606.jpg" ,
                      "ceci2k607.jpg" ,
                      "ceci2k608.jpg" ,
                      "ceci2k609. jpg"

                      I now you said it does after the all to addThumnails(), but I'm still
                      not clear what's in it after the call to getFromMySql().

                      --
                      =============== ===
                      Remove the "x" from my email address
                      Jerry Stuckle
                      JDS Computer Training Corp.
                      jstucklex@attgl obal.net
                      =============== ===

                      Comment

                      • Martien van Wanrooij

                        #12
                        Re: array / mysql question -SOLVED :-)


                        "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                        news:t9WdnSwzjb yWdenYnZ2dnUVZ_ qGdnZ2d@comcast .com...
                        >
                        OK, I'm just having a little trouble understanding here. After your call
                        to getFromMySql(), does the array actually contain the values
                        >
                        "ceci2k600.jpg" ,
                        "ceci2k601.jpg" ,
                        "ceci2k602.jpg" ,
                        "ceci2k603.jpg" ,
                        "ceci2k604.jpg" ,
                        "ceci2k605.jpg" ,
                        "ceci2k606.jpg" ,
                        "ceci2k607.jpg" ,
                        "ceci2k608.jpg" ,
                        "ceci2k609. jpg"
                        Yes it does.. but finally I found the solution, the problem was somewhere
                        else. I had used a script to add the filenames to the database and it turned
                        out in that script, some spaces were added to each. I used rtrim for the
                        result and everything works fine now. So in the database there was not
                        "ceci2k600. jpg" but "ceci2k600. jpg " .
                        Thanks for all the help anyway and sorry for having bothered you so much

                        Martien.

                        Comment

                        • Jerry Stuckle

                          #13
                          Re: array / mysql question -SOLVED :-)

                          Martien van Wanrooij wrote:
                          >
                          "Jerry Stuckle" <jstucklex@attg lobal.netschree f in bericht
                          news:t9WdnSwzjb yWdenYnZ2dnUVZ_ qGdnZ2d@comcast .com...
                          >
                          >>
                          >OK, I'm just having a little trouble understanding here. After your
                          >call to getFromMySql(), does the array actually contain the values
                          >>
                          >"ceci2k600.jpg ",
                          >"ceci2k601.jpg ",
                          >"ceci2k602.jpg ",
                          >"ceci2k603.jpg ",
                          >"ceci2k604.jpg ",
                          >"ceci2k605.jpg ",
                          >"ceci2k606.jpg ",
                          >"ceci2k607.jpg ",
                          >"ceci2k608.jpg ",
                          >"ceci2k609.jpg "
                          >
                          Yes it does.. but finally I found the solution, the problem was
                          somewhere else. I had used a script to add the filenames to the database
                          and it turned out in that script, some spaces were added to each. I used
                          rtrim for the result and everything works fine now. So in the database
                          there was not "ceci2k600. jpg" but "ceci2k600. jpg " .
                          Thanks for all the help anyway and sorry for having bothered you so much
                          >
                          Martien.
                          >
                          Martien,

                          Ah, yes, and such problems are very difficult to see on a screen. Glad
                          you found your bug!

                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstucklex@attgl obal.net
                          =============== ===

                          Comment

                          Working...