Click here to Skip to main content
15,888,350 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
PHP
<script type="text/javascript">
			$(window).load(function(){
				$("a[data-gal^='prettyVideo']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
				$("a[data-gal^='prettyVideo_1']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
				$("a[data-gal^='prettyVideo_2']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
			}); 
		</script>		



PHP
	$(window).load(function(){
<?php
require "config.php";  
$query = "SELECT * FROM videodetails where album='" . $_GET['album'] . "'";
$result = mysql_query($query);
$nume=mysql_num_rows($result);
$i=0;
while ($row = mysql_fetch_array($result)) {
$val="prettyVideo" . $i;
$i=$i+1;
?>
$("a[data-gal^='"+<?php echo($val); ?>+"']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:false, autoplay_slideshow: false});
<?php } ?>

			}); 
		</script>		


What is error in second code part?
I need to convert the first code part to second part.
Posted
Updated 1-Jul-20 7:04am

Hi,

Here's a tutorial about convert JavaScript to PHP:
http://php.bigresource.com/Convert-JavaScript-to-PHP-k6kTD0sR.html[^]
 
Share this answer
 
v2
Comments
[no name] 11-Oct-12 15:54pm    
I need the difference between above two code
I know php a little bit but more than that link.
home so
BTW thanks for the reply
In your Javascript the selectors are "prettyVideo", "prettyVideo_1" and "prettyVideo_2".

In the PHP code you are appending a number to "prettyVideo", so your selectors will match "prettyVideo0", "prettyVideo1", "prettyVideo2" and so on.
 
Share this answer
 
Comments
[no name] 11-Oct-12 15:52pm    
Thanks for your reply!

I didn't ask for the explanation
I need to find out the difference.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900