It should not be too hard to do this. What other images would you like to show? What variables would your programming identify that would cause it to display different images?
mattibutt
ASKER
hi ray
i hope you are well, for now i just want to add few more images are you asking about name of the images?
say if poll has more options like 3 or 4 i would like to have different images for each poll result
Ray Paseur
Thanks. I would think you might modify the function above to add the "extra image" logic. It looks like the code is putting an image into a table, and calculating the width of the image. Perhaps somewhere in that area you could add the code to present another image.
In an unrelated matter, it looks like this code is doing 4 queries against one data base table. A more efficient approach might be to combine the queries. Just a thought.
hi ray
how do i write the logic for another image shed some light if u can
Ray Paseur
If you can tell me what circumstances would exist that would signal your program to use another image, we can put in some "if" statements to test for these circumstances. We could also add a field to the function definition to pass an image identifier into the function, and then we could use the image identifier to get the image file name into the generated HTML. Does that make sense? ~Ray
mattibutt
ASKER
hi ray
the circumstances for displaying more then image would be if the row which is option text greater then one
this is how its shown in the browser, if i can display each option box with different image that would be great
<table cellpadding=0 cellspacing=4>
<tr>
<td>option 1</td>
<td><img src="poll_bar.jpg" height=55 width=128 alt="option 1"></td>
<td>44.4 % </td>
</tr>
<tr>
<td>option 2</td>
<td><img src="poll_bar.jpg" height=55 width=96 alt="option 2"></td>
<td>33.3 % </td>
</tr>
<tr>
<td>option 3</td>
<td><img src="poll_bar.jpg" height=55 width=64 alt="option 3"></td>
<td>22.2 % </td>
</tr>
</table>
mattibutt
ASKER
maybe i have not been able to explain to you properly
mattibutt
ASKER
i have added one more image but its showing it twice i dont understand what to change for each option text box will show different image
echo "<td><img src=\"".$tapps_dir."image5.jpg\" height=55 width=$w alt=\"$s\"></td>\n";
printf("<td>%.1f %% </td>\n", $p, $row->counter);
echo "<td><img src=\"".$tapps_dir."poll_bar.jpg\" height=55 width=$w alt=\"$s\"></td>\n";
printf("<td>%.1f %% </td>\n", $p, $row->counter);
right now all the results are assigned to this $s = strip_tags($row->option_text); i think if i can break this down in for example row 1 then image1 and row2 then image2 etc
OK, so one row for each instance. Got it. Where will the images be found? How will we know which image should go with each row?
mattibutt
ASKER
some way to break down this $s = strip_tags($row->option_text); for instance largest option_text will have image1 and then if its smaller then image2
$s = strip_tags($row->option_text);
echo "<td><img src=\"".$tapps_dir."image5.jpg\" height=55 width=$w alt=\"$s\"></td>\n";
printf("<td>%.1f %% </td>\n", $p, $row->counter);
Ray Paseur
I'm still not getting it. "largest option_text" - what does"largest" mean in this context?
hi ray
sorry once again for confusing you
printf("<td>%.1f %% </td>\n", $p, $row->counter); the counter has value of poll results in percentage (42.9 %) so i am thinking some if statement where largest printf("<td>%.1f %% </td>\n", $p, $row->counter); will have different image
mattibutt
ASKER
can i do this in php like
original code
$s = strip_tags($row->option_text);
echo "<td><img src=\"".$tapps_dir."image5.jpg\" height=55 width=$w alt=\"$s\"></td>\n";
printf("<td>%.1f %% </td>\n", $p, $row->counter);
desire modification
$s = strip_tags($row(here someway i can enter row number)->option_text);
echo "<td><img src=\"".$tapps_dir."different.jpg\" height=55 width=$w alt=\"$s\"></td>\n";
printf("<td>%.1f %% </td>\n", $p, $row->counter);