Connecting Tech Pros Worldwide Forums | Help | Site Map

Populate javascript array(s) from mysql

mike@liqua.com
Guest
 
Posts: n/a
#1: Jul 23 '05
I'm fairly green with javascript, and have been looking everywhere for
an example of how to load data from a mysql db into javascript arrays.

For a little background on what I'm trying to do, any suggestions would
be greatly appreciated... I have a table in a mysql db that data for
banners, each record includes the image name of the banner and the url.
I need to randomly display the banners in that table, auto refreshing
every 5-10 secs (the reason I was going to use javascript for this) on
a page.

I've already looked at
http://devshed.spunge.org/Server_Side/MySQL/JS_Arrays/ with not much
luck, about the only place I could find info on loading mysql data into
a javascript array(s).

Any suggestions or examples would be greatly appreciated!

Thanks!


Randell D.
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Populate javascript array(s) from mysql


mike@liqua.com wrote:
[color=blue]
> I'm fairly green with javascript, and have been looking everywhere for
> an example of how to load data from a mysql db into javascript arrays.
>
> For a little background on what I'm trying to do, any suggestions would
> be greatly appreciated... I have a table in a mysql db that data for
> banners, each record includes the image name of the banner and the url.
> I need to randomly display the banners in that table, auto refreshing
> every 5-10 secs (the reason I was going to use javascript for this) on
> a page.
>
> I've already looked at
> http://devshed.spunge.org/Server_Side/MySQL/JS_Arrays/ with not much
> luck, about the only place I could find info on loading mysql data into
> a javascript array(s).
>
> Any suggestions or examples would be greatly appreciated!
>
> Thanks!
>[/color]

You won't be able to use client side javascript to populate data from a
database - Are you using server based javascript? I believe it exists,
but I've never seen/used it.

If I were you, I'd use PHP to create the javascript array... others
would suggest other server side languages, like Perl...

But MySQL (or any database for that matter) and javascript just won't
dance on their own...

randelld
Closed Thread