RE: [PHP] Javascript and php
| From: | Reinhart Viane | Date: | Sun, 07 Nov 2004 11:44:33 +0000 |
| Subject: | RE: [PHP] Javascript and php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201417@lists.php.net to get a copy of this message | ||
Thank you very much,
After some small adjustements to make it work with the rest of the
javascript it works like a charm!!
Have a nice Sunday :)
Greetings,
Reinhart
-----Original Message-----
From: Bruno B B Magalhães [mailto:brunobbm@rio.com.br]
Sent: zondag 7 november 2004 12:33
To: php-general@lists.php.net
Subject: Re: [PHP] Javascript and php
Reinhart,
<?php
for($i = 0; $i < mysql_num_rows($result)-1; $i++)
{
$row = mysql_fetch_object($result);
echo '"'.$row->picture_url.'"';
if($i <= mysql_num_rows($result)-2)
{
echo ',';
}
}
?>
Here is how I do in my developments.
Regards,
Bruno B B Magalhães
On Nov 7, 2004, at 8:44 AM, Reinhart Viane wrote:
> Hey all,
> Hope some of you also work on sundays :)
>
> I have a little javascript which displays a images (with previous /
> next
> thing)
> Now, i populate the javascript array with an php array:
>
> <SCRIPT LANGUAGE="JavaScript">
>
> <!-- Begin
> NewImg = new Array (
> <?php
> while($row = mysql_fetch_object($result)){
> echo "\"".$row->picture_url."\",";
> }
> ?>
> "../pictures/7_stripper3.jpg",
> "../pictures/7_stripper2.jpg"
> );
> var ImgNum = 0;
> var ImgLength = NewImg.length - 1;
> ...
> </script>
>
> As you can see i echo the url of the picture.
> After each picture url there needs to be a ','
> But not after the last picture.
> At this moment all pictures have the ',' after there url, even the
> last one. Any way to determine if the url is the url of the last
> picture and thus not printing a ',' behind that last one?
>
> Thx in advance,
>
> Reinhart
>
> _____
>
> Reinhart Viane
> <mailto:rv@domos.be> rv@domos.be
> Domos || D-Studio
> Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01
> --
> fax +32 15 43 25 26
>
>
> STRICTLY PERSONAL AND CONFIDENTIAL
> This message may contain confidential and proprietary material for the
> sole use of the intended recipient. Any review or distribution by
> others is strictly prohibited.
> If you are not the intended
> recipient please contact the sender and delete all copies.
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php