Jump to content

how to access database values through javascript


anupaul

Recommended Posts

You need to use the GD library in PHP to create an image with your query information, then use javascript to change the image's source property.

 

Or you could use AJAX.

 

But I did that shit before there even was an XML request object, and I'll do long after W3C deprecates it.

You need to use the GD library in PHP to create an image with your query information, then use javascript to change the image's source property.

 

Or you could use AJAX.

 

But I did that shit before there even was an XML request object, and I'll do long after W3C deprecates it.

 

why do you need to you GD lib?

how to access database values through javascript.

I need  to pass values from html to php through javascript.For that i need to accesss database table values in my javascript.how will i access it? .

 

theres no way you can access your DB using JS ! only server side script can do that BTW

whats the use of GD here? I dont see any relevance using GD to access the DB using JS ?

Can you explain it mate?

Back a long long time ago, you couldn't load in XML like you can now, but you could change the source of an image with javascript. It lend to a bunch of hacks, for example, if you wanted to do hit counter in real time, you could repeated load an image like:

 

"stats.gif?nocache="+Math.random()

 

You can use the same concept to load database records, and not use AJAX, with the downsides of course being that the javascript can't actually access that data, and that you need to create a static image to display it with.

Back a long long time ago, you couldn't load in XML like you can now, but you could change the source of an image with javascript. It lend to a bunch of hacks, for example, if you wanted to do hit counter in real time, you could repeated load an image like:

 

"stats.gif?nocache="+Math.random()

 

You can use the same concept to load database records, and not use AJAX, with the downsides of course being that the javascript can't actually access that data, and that you need to create a static image to display it with.

that doesn't make sense i believe ?  when you load db records still you have to access it using your server script ? correct me if i was wrong with that.. so why do you have to use image? data wont be handy using your way ???

It does actually make sense, although is a very large hack. :P

You would have an image like this:

<img src="path/to/image.php" />

 

Now you can see where GD comes in. The php page could then access the data and display it on the image. But as he said, you couldn't really "get" the data.

Back a long long time ago, you couldn't load in XML like you can now, but you could change the source of an image with javascript. It lend to a bunch of hacks, for example, if you wanted to do hit counter in real time, you could repeated load an image like:

 

"stats.gif?nocache="+Math.random()

 

You can use the same concept to load database records, and not use AJAX, with the downsides of course being that the javascript can't actually access that data, and that you need to create a static image to display it with.

that doesn't make sense i believe ?  when you load db records still you have to access it using your server script ? correct me if i was wrong with that.. so why do you have to use image? data wont be handy using your way ???

 

It doesn't make sense anymore, now that we have an Xmlhttprequest object. Back then, when it wasn't around, that would be quite a clever way of doing things.

 

----------------

Now playing: Linkin Park - Rnw@Y (Backyard Bangers ft. Phoenix Orion)

via FoxyTunes

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.