anupaul Posted July 23, 2008 Share Posted July 23, 2008 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? . Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/ Share on other sites More sharing options...
cooldude832 Posted July 23, 2008 Share Posted July 23, 2008 have you looked at asynchronous JavaScript and XML at all??? Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597146 Share on other sites More sharing options...
vbnullchar Posted July 23, 2008 Share Posted July 23, 2008 you dont need to have it bold+red.. we can read it.. try reading about AJAX Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597157 Share on other sites More sharing options...
cooldude832 Posted July 23, 2008 Share Posted July 23, 2008 you dont need to have it bold+red.. we can read it.. try reading about AJAX so what is asynchronous JavaScript and XML ??? (Oh wait thats AJAX) lol maybe you should let them research and discover Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597162 Share on other sites More sharing options...
tibberous Posted July 23, 2008 Share Posted July 23, 2008 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. Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597164 Share on other sites More sharing options...
vbnullchar Posted July 23, 2008 Share Posted July 23, 2008 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? Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597172 Share on other sites More sharing options...
teng84 Posted July 23, 2008 Share Posted July 23, 2008 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? Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597178 Share on other sites More sharing options...
tibberous Posted July 23, 2008 Share Posted July 23, 2008 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. Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597190 Share on other sites More sharing options...
teng84 Posted July 23, 2008 Share Posted July 23, 2008 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 ??? Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597196 Share on other sites More sharing options...
JasonLewis Posted July 23, 2008 Share Posted July 23, 2008 It does actually make sense, although is a very large hack. 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. Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597291 Share on other sites More sharing options...
LemonInflux Posted July 23, 2008 Share Posted July 23, 2008 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 Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597300 Share on other sites More sharing options...
cooldude832 Posted July 23, 2008 Share Posted July 23, 2008 You can update any div, img, frame, etc. using javascript so you don't have to use an image AJAX can then update a div with the html.response and you have ajax database updating Link to comment https://forums.phpfreaks.com/topic/116124-how-to-access-database-values-through-javascript/#findComment-597617 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.