/    Sign up×
Community /Pin to ProfileBookmark

PHP Code in javascript?

hi all

I have the following code in teh javascript function
i wanna get these values from MySQL though PHP. how can I or I cant?

[CODE] [“slideshow/1.jpg”, “slide_files/links/1.php”, “_new”, “”],
[“slideshow/2.jpg”, “slide_files/links/2.php”, “”, “”],
[“slideshow/3.jpg”, “slide_files/links/3.php”, “”, “”],
[“slideshow/4.jpg”, “slide_files/links/4.php”, “”, “”],
[“slideshow/5.jpg”, “slide_files/links/5.php”, “”, “”],
[“slideshow/6.jpg”, “slide_files/links/6.php”, “”, “”]
[/CODE]

thanks in advance

regards
Jack

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@scragarAug 27.2009 — You may need to explain yourself a lot clearer. What are you after getting from MySQL? What have you tried? How does the table look? Do you already have code for a connection?...
Copy linkTweet thisAlerts:
@TeufelAug 27.2009 — Just do something like this:

[code=php]
while ($result = $db->fetchArray()) {
echo '["slideshow/'.$result["id"].'", "slide_files/links/'.$result["id"].'", "'.$result["target"].'", ""],'."n";
}
[/code]


Where id is 1,2,3,4,5,6 and target is "_new" or "" (_new should be "_blank" btw)
Copy linkTweet thisAlerts:
@jack001authorAug 27.2009 — You may need to explain yourself a lot clearer. What are you after getting from MySQL? What have you tried? How does the table look? Do you already have code for a connection?...[/QUOTE]


below is my complete code of javascript for a slide showeshow...

actually I am uploading the images in MySQL database. the below code creates a slideshow with images from database... this codes uses 6 images... which is static kind of slideshow. i want something where the user enter as many images as he wants and it will loop through the record set from the database... so the [B]imagearray[/B] in the javascript i need from the database....


[CODE]<script type="text/javascript">

var mygallery=new simpleGallery({
wrapperid: "simplegallery1", //ID of main gallery container,
dimensions: [427, 323], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
imagearray: [
["slideshow/1.jpg", "slide_files/links/1.php", "_new", ""],
["slideshow/2.jpg", "slide_files/links/2.php", "", ""],
["slideshow/3.jpg", "slide_files/links/3.php", "", ""],
["slideshow/4.jpg", "slide_files/links/4.php", "", ""],
["slideshow/5.jpg", "slide_files/links/5.php", "", ""],
["slideshow/6.jpg", "slide_files/links/6.php", "", ""]
],
autoplay: [true, 2500, 2], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 700, //transition duration (milliseconds)
oninit:function(){ //event that fires when gallery has initialized/ ready to run
//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
},
onslide:function(curslide, i){ //event that fires after each slide is shown
//Keyword "this": references current gallery instance
//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
}
})

</script>
[/CODE]
×

Success!

Help @jack001 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...