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 "    $temp <br> ";
while($k<count( $thirdlevel[$i][$j])){
$temp=$thirdlev el[$i][$j][$k];
settype($temp, "string");
echo "        $temp <br> ";
$k++;
}
$j++;
}
$i++;
}
?>
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 "    $temp <br> ";
while($k<count( $thirdlevel[$i][$j])){
$temp=$thirdlev el[$i][$j][$k];
settype($temp, "string");
echo "        $temp <br> ";
$k++;
}
$j++;
}
$i++;
}
?>
Comment