Getting Php Recordset To Display With Javascript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jbh
Forum Commoner
Posts: 89
Joined: Tue Dec 05, 2006 7:01 pm

Getting Php Recordset To Display With Javascript

Post by jbh »

Hey,

Is there any *proven* way (i've searched all day through google/forums) to display a mysql result through javascript?

Imagine that I have a file that has already queried a db and has the variable $dataset

All I want is to do this in my php file:


echo "<script language=\"text/JavaScript\">\n";
// insert $dataset
echo "</script>";

I know how to get HTML to display through a javascript file and a PHP server variable. But I have a MYSQL recordset that
IS html code (Long story, but I am pulling from a remote server an html page I want to rotate)

So in short, I cannot figure out the correct syntax to take my $dataset and display it. Since this php file is being called
through a javascript tag, it would allow other servers to display data from *my* server. I can get my html files to show through
javascript src tags but not the darn dataset.

I appreciate any help. I'm about to burst :/

Again, thanks for reading this.

PS. If you are wondering why I am doing this and not using an include of a full url, I want to create a service that rotates html/php + html
data without servers depending on fopen url settings enabled. So I figured a javascript src connecting to my server would be the way.
Post Reply