I am sure this is a lot simpler then I have made it so please tear me to shreds with horrible comments.
I have 10 columns of text stored in a MySQL database i would like to append a '>' between each set of text making one string.
For example:
5 4 3 2 1
Would then become
5 > 4 > 3 > 2 > 1
however if one of the columns was empty
_ 4 3 2 1
it would NOT appear as
> 4 > 3 > 2 > 1
But
4 > 3 > 2 > 1
Here is what I did.... Please been gentle!!!
Code: Select all
<?php
$path1 = "{$row["path1"]}";
$path2 = "{$row["path2"]}";
$path3 = "{$row["path3"]}";
$path4 = "{$row["path4"]}";
$path5 = "{$row["path5"]}";
$path6 = "{$row["path6"]}";
$path7 = "{$row["path7"]}";
$path8 = "{$row["path8"]}";
$path9 = "{$row["path9"]}";
$path10 = "{$row["path10"]}";
if(!empty($path10)){echo $path10. " > ";}
if(!empty($path9)){echo $path9 . " > ";}
if(!empty($path8)){echo $path8 . " > ";}
if(!empty($path7)){echo $path7 . " > ";}
if(!empty($path6)){echo $path6 . " > ";}
if(!empty($path5)){echo $path5 . " > ";}
if(!empty($path4)){echo $path4 . " > ";}
if(!empty($path3)){echo $path3 . " > ";}
if(!empty($path2)){echo $path2 . " > ";}
if(!empty($path1)){echo $path1;}
?>Thanks guyz!
Sometime other peoples stupidity is funny