Getting Php Recordset To Display With Javascript
Posted: Tue May 27, 2008 10:15 pm
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.
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.