I have a comma separated list of colors taken from a database ($ICo) and a directory of images named "color". The images are named the "color.jpg"
I am attempting to loop through this list and display the corresponding image from the directory in a table with the color name below it.
I am unable to get it to loop through the list, it displays the correct number of images but they are all the first image with the name under it.
The script I have at this stage is
Code: $columns = 5;
$Color = "$ICo";
$col = explode(",", $Color);
$num = count($col)-1;
echo "<table border='0' cellspacing='2' cellpadding='0'>n";
for($i = 0; $i < $num; $i++) {
if($i % $columns == 0) {
echo "<tr>n";
}
$Name = $col[0];
$pic = "../store/color/$Name.jpg";}
echo "<td align="center" valign="top" width="70" ><img src="$pic" name="$Name" border="1" width="68" height="36">
$Name</td>n";
while ($num >= $col);
if(($i % $columns) == ($columns - 1) || ($i + 1) == $num) {
echo "</tr>n";
}
echo "</table>n";
I have spent hours trying to figure out where I am going wrong.
I know the line "$Name = $col[0];" is incorrect, could somebody please point me in the right direction
Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time around I'm having terrible luck. Basically, I made the crappiest login system ever. I'm using
help with calculations on a flat text file
hello,I have this code below that is attached to a flat file like this:Email:LastName:FirstName:Assignment1,100:Assignment2,100:Quiz1,50someone@email.com:Doe:John:85:93:45Here is the code:
How to display objects in a row
I have 7 codes that i want to display in a row one next to another.The first is {$ads->ads_display('1')}, the second {$ads->ads_display('2')} and so on...They appear one under the other.
finding key position of specified value in multi-dimensional array
Code: $openedfile = fopen($tfc_file4, "r");$rc = 1;while(!feof($openedfile)){$rc++;$hold[$rc] = explode("|" , trim(fgets($openedfile)));}fclose($openedfile);How can I loop through
Varible in trigger - refering to correct schema
Hello
Looping Problem
I've got a client that has a database with about 200 events at any given time. I'm trying to loop through the dates based on a form and show the title of the event if the start date of the form
Baffled by Undefined Index in Simple Array: Please Help!
Hello. I have a form which posts an array to this script. However, I can't seem to access the values in the array; I keep getting an undefined index. Something is not right, but the code is so simple!
Problems with adding a link to one position in a 'foreach' loop, please help
Hello!Iam pretty new to programming and I wanna create a table with users from an array. It works just fine but in one table row I wanna add a link to it so I can click on the username to edit it
puting for loop in 1 value
hi ,how do i put this code in 1 value:Code: <?phpfor ($i=1; $i<=5; $i++) { echo $i ; }?>the output will be: 12345how do i put the result in one value ,some thing like :if the
Connection Timeout
I'm using xmii 12.0