|  | Posted by David Haynes on 02/17/06 19:32 
Cleverbum@hotmail.com wrote:> Hi,
 >  I've written some code to create a little list thing based on the
 > names of some tables in a mySQL database, but I get an error that i
 > can't seem to fix and i was wondering if anyone could take a look and
 > give me a hand.
 >
 > The error is
 > Parse error: parse error, unexpected $ in
 > /home/cleverbu/public_html/test.php on line 84
 >
 > my code is (password removed):
 >
 > <?php
 >
 > $username="cleverbu_Root";
 > $password="";
 > $database="cleverbu_photos";
 > mysql_connect(localhost,$username,$password);
 > @mysql_select_db($database) or die( "Unable to select database, please
 > go back, hit refresh and try again");
 >
 > $result=mysql_list_tables($database);
 >
 > mysql_close();
 >
 > $rootscount=0;
 > $i=0;
 > while($i<mysql_num_rows($result)){
 >
 >  $tname = mysql_tablename($result,$i);
 >
 >  $expl_tname = explode("_",$tname,2);
 >
 >  $ii=0;
 >  $found=0;
 >  while($ii<$rootscount){
 >   if($expl_tname[0]==$roots[$ii]){
 >    $expl_two_tname = explode("_",$expl_tname[1],2);
 >
 >    if($expl_two_tname[1]==""){
 >    $numalbs=count($albums[$ii]);
 >    $albums [$ii][$numalbs] = $expl_tname[1];
 >    }
 >    else
 >    {
 >     $ltwofound=0;
 >     while($iii<count($albums[$ii])){
 >     if($expl_two_tname[0]==$albums[$ii][$iii]){
 >      $numthirds=count($albums[$ii][$iii]);
 >      $thirdlevel[$ii][$iii][$numthirds]=$expl_two_tname[1];
 >      $ltwofound=1;
 >     }
 >     if($ltwofound==0){
 >      $numalbs=count($albums[$ii]);
 >      $albums [$ii][$numalbs] = $expl_tname[1];
 >      $thirdlevel [$ii][$numalbs][0]=$expl_two_tname[1];
 >    }
 >
 >    $found=1;
 >   }
 >   $ii++;
 >  }
 >  if($found==0){
 >   $roots[$rootscount]=$expl_tname[0];
 >   $albums[$rootscount][0] = $expl_tname[1];
 >
 >   $expl_two_tname = explode("_",$expl_tname[1],2);
 >   if($expl_two_tname[1]!=""){
 >    $thirdlevel [$rootscount][0][0]=$expl_two_tname[1];
 >   }
 >
 >   $rootscount++;
 >  }
 >  $i++;
 > }
 >
 > $i=0;
 > while($i<$rootscount){
 > $j=0;
 >  echo "$roots[$i] <br>";
 >  while($j<count($albums[$i])){
 >   $k=0;
 >   $temp=$albums[$i][$j];
 >   settype($temp, "string");
 >   echo "    $temp <br> ";
 >   while($k<count($thirdlevel[$i][$j])){
 >    $temp=$thirdlevel[$i][$j][$k];
 >    settype($temp, "string");
 >    echo "        $temp <br> ";
 >    $k++;
 >   }
 >   $j++;
 >  }
 >  $i++;
 > }
 >
 > ?>
 >
 
 You are missing two '}'s before the closing ?>
 
 -david-
  Navigation: [Reply to this message] |