Can't seem to work out the problem

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

    Can't seem to work out the problem

    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="clev erbu_Root";
    $password="";
    $database="clev erbu_photos";
    mysql_connect(l ocalhost,$usern ame,$password);
    @mysql_select_d b($database) or die( "Unable to select database, please
    go back, hit refresh and try again");

    $result=mysql_l ist_tables($dat abase);

    mysql_close();

    $rootscount=0;
    $i=0;
    while($i<mysql_ num_rows($resul t)){

    $tname = mysql_tablename ($result,$i);

    $expl_tname = explode("_",$tn ame,2);

    $ii=0;
    $found=0;
    while($ii<$root scount){
    if($expl_tname[0]==$roots[$ii]){
    $expl_two_tname = explode("_",$ex pl_tname[1],2);

    if($expl_two_tn ame[1]==""){
    $numalbs=count( $albums[$ii]);
    $albums [$ii][$numalbs] = $expl_tname[1];
    }
    else
    {
    $ltwofound=0;
    while($iii<coun t($albums[$ii])){
    if($expl_two_tn ame[0]==$albums[$ii][$iii]){
    $numthirds=coun t($albums[$ii][$iii]);
    $thirdlevel[$ii][$iii][$numthirds]=$expl_two_tnam e[1];
    $ltwofound=1;
    }
    if($ltwofound== 0){
    $numalbs=count( $albums[$ii]);
    $albums [$ii][$numalbs] = $expl_tname[1];
    $thirdlevel [$ii][$numalbs][0]=$expl_two_tnam e[1];
    }

    $found=1;
    }
    $ii++;
    }
    if($found==0){
    $roots[$rootscount]=$expl_tname[0];
    $albums[$rootscount][0] = $expl_tname[1];

    $expl_two_tname = explode("_",$ex pl_tname[1],2);
    if($expl_two_tn ame[1]!=""){
    $thirdlevel [$rootscount][0][0]=$expl_two_tnam e[1];
    }

    $rootscount++;
    }
    $i++;
    }

    $i=0;
    while($i<$roots count){
    $j=0;
    echo "$roots[$i] <br>";
    while($j<count( $albums[$i])){
    $k=0;
    $temp=$albums[$i][$j];
    settype($temp, "string");
    echo "&nbsp &nbsp $temp <br> ";
    while($k<count( $thirdlevel[$i][$j])){
    $temp=$thirdlev el[$i][$j][$k];
    settype($temp, "string");
    echo "&nbsp &nbsp &nbsp &nbsp $temp <br> ";
    $k++;
    }
    $j++;
    }
    $i++;
    }

    ?>

  • d

    #2
    Re: Can't seem to work out the problem

    <Cleverbum@hotm ail.com> wrote in message
    news:1140195744 .115908.262480@ g47g2000cwa.goo glegroups.com.. .[color=blue]
    > 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[/color]

    You seem to have not closed your "if($ltwofound= =0)", or something similar
    (it's hard to tell due to the lack of indentation)...

    dave
    [color=blue]
    > my code is (password removed):
    >
    > <?php
    >
    > $username="clev erbu_Root";
    > $password="";
    > $database="clev erbu_photos";
    > mysql_connect(l ocalhost,$usern ame,$password);
    > @mysql_select_d b($database) or die( "Unable to select database, please
    > go back, hit refresh and try again");
    >
    > $result=mysql_l ist_tables($dat abase);
    >
    > mysql_close();
    >
    > $rootscount=0;
    > $i=0;
    > while($i<mysql_ num_rows($resul t)){
    >
    > $tname = mysql_tablename ($result,$i);
    >
    > $expl_tname = explode("_",$tn ame,2);
    >
    > $ii=0;
    > $found=0;
    > while($ii<$root scount){
    > if($expl_tname[0]==$roots[$ii]){
    > $expl_two_tname = explode("_",$ex pl_tname[1],2);
    >
    > if($expl_two_tn ame[1]==""){
    > $numalbs=count( $albums[$ii]);
    > $albums [$ii][$numalbs] = $expl_tname[1];
    > }
    > else
    > {
    > $ltwofound=0;
    > while($iii<coun t($albums[$ii])){
    > if($expl_two_tn ame[0]==$albums[$ii][$iii]){
    > $numthirds=coun t($albums[$ii][$iii]);
    > $thirdlevel[$ii][$iii][$numthirds]=$expl_two_tnam e[1];
    > $ltwofound=1;
    > }
    > if($ltwofound== 0){
    > $numalbs=count( $albums[$ii]);
    > $albums [$ii][$numalbs] = $expl_tname[1];
    > $thirdlevel [$ii][$numalbs][0]=$expl_two_tnam e[1];
    > }
    >
    > $found=1;
    > }
    > $ii++;
    > }
    > if($found==0){
    > $roots[$rootscount]=$expl_tname[0];
    > $albums[$rootscount][0] = $expl_tname[1];
    >
    > $expl_two_tname = explode("_",$ex pl_tname[1],2);
    > if($expl_two_tn ame[1]!=""){
    > $thirdlevel [$rootscount][0][0]=$expl_two_tnam e[1];
    > }
    >
    > $rootscount++;
    > }
    > $i++;
    > }
    >
    > $i=0;
    > while($i<$roots count){
    > $j=0;
    > echo "$roots[$i] <br>";
    > while($j<count( $albums[$i])){
    > $k=0;
    > $temp=$albums[$i][$j];
    > settype($temp, "string");
    > echo "&nbsp &nbsp $temp <br> ";
    > while($k<count( $thirdlevel[$i][$j])){
    > $temp=$thirdlev el[$i][$j][$k];
    > settype($temp, "string");
    > echo "&nbsp &nbsp &nbsp &nbsp $temp <br> ";
    > $k++;
    > }
    > $j++;
    > }
    > $i++;
    > }
    >
    > ?>
    >[/color]


    Comment

    • David Haynes

      #3
      Re: Can't seem to work out the problem

      Cleverbum@hotma il.com wrote:[color=blue]
      > 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="clev erbu_Root";
      > $password="";
      > $database="clev erbu_photos";
      > mysql_connect(l ocalhost,$usern ame,$password);
      > @mysql_select_d b($database) or die( "Unable to select database, please
      > go back, hit refresh and try again");
      >
      > $result=mysql_l ist_tables($dat abase);
      >
      > mysql_close();
      >
      > $rootscount=0;
      > $i=0;
      > while($i<mysql_ num_rows($resul t)){
      >
      > $tname = mysql_tablename ($result,$i);
      >
      > $expl_tname = explode("_",$tn ame,2);
      >
      > $ii=0;
      > $found=0;
      > while($ii<$root scount){
      > if($expl_tname[0]==$roots[$ii]){
      > $expl_two_tname = explode("_",$ex pl_tname[1],2);
      >
      > if($expl_two_tn ame[1]==""){
      > $numalbs=count( $albums[$ii]);
      > $albums [$ii][$numalbs] = $expl_tname[1];
      > }
      > else
      > {
      > $ltwofound=0;
      > while($iii<coun t($albums[$ii])){
      > if($expl_two_tn ame[0]==$albums[$ii][$iii]){
      > $numthirds=coun t($albums[$ii][$iii]);
      > $thirdlevel[$ii][$iii][$numthirds]=$expl_two_tnam e[1];
      > $ltwofound=1;
      > }
      > if($ltwofound== 0){
      > $numalbs=count( $albums[$ii]);
      > $albums [$ii][$numalbs] = $expl_tname[1];
      > $thirdlevel [$ii][$numalbs][0]=$expl_two_tnam e[1];
      > }
      >
      > $found=1;
      > }
      > $ii++;
      > }
      > if($found==0){
      > $roots[$rootscount]=$expl_tname[0];
      > $albums[$rootscount][0] = $expl_tname[1];
      >
      > $expl_two_tname = explode("_",$ex pl_tname[1],2);
      > if($expl_two_tn ame[1]!=""){
      > $thirdlevel [$rootscount][0][0]=$expl_two_tnam e[1];
      > }
      >
      > $rootscount++;
      > }
      > $i++;
      > }
      >
      > $i=0;
      > while($i<$roots count){
      > $j=0;
      > echo "$roots[$i] <br>";
      > while($j<count( $albums[$i])){
      > $k=0;
      > $temp=$albums[$i][$j];
      > settype($temp, "string");
      > echo "&nbsp &nbsp $temp <br> ";
      > while($k<count( $thirdlevel[$i][$j])){
      > $temp=$thirdlev el[$i][$j][$k];
      > settype($temp, "string");
      > echo "&nbsp &nbsp &nbsp &nbsp $temp <br> ";
      > $k++;
      > }
      > $j++;
      > }
      > $i++;
      > }
      >
      > ?>
      >[/color]

      You are missing two '}'s before the closing ?>

      -david-

      Comment

      • Cleverbum@hotmail.com

        #4
        Re: Can't seem to work out the problem

        Thanks very much. found where i was missing them :)

        Comment

        Working...