View Full Version : redirect to html
sky2070
07-04-2003, 03:49 AM
how to redirect query output into html file in mysql 4.0.12
Welcome here.
I don't quite understand the question. I assume you want to use the results of a select-query and display them in a html page.
That's not possible. But you can use a server side scripting language (ASP or PHP or JSP or ...)to run the select and generate the html with the results from your select in (like it is done here)
I'd suggest using PHP since it's the privilidged language for MySQL
If you're going to use PHP, i'd recommend that you take a few hours to work through this tutorial
http://www.sitepoint.com/article/228/2
it's basic, but it'll tell you all you need to build and proces your furst forms.
sky2070
07-06-2003, 07:27 AM
i am using mysql -H command to open the connection so that query return result with html formating so i can cut and paste the result into html file. i am trying to find out a way to automaticaly redirect the result into a html file.
I see.
As far as i know, you can only send the output to an outputfile (like html-file) when you do a batchjob.
i've made a little batchfile to test this out. Here's the code (for windows machine)
cd c:
cd \
cd phpdev\mysql\bin
mysql -h localhost -u root -p -H < test.sql > mysql.html
You might need to change the directorys, but the main thing is the last command. It basically opent the commandline, prompt for a password and then executes test.sql
Test.sql is a file i made in notepad, thet holds a few sql commands. In this case
use test;
select * from testerbis;
This file is stored in the bin-directory
The mysql.html is a file that is created when i run the batchile (in the bin-directory)
I've attached it below (in zipfile)
The only problem i see, is the first line 'Enter password'. But i thing that if you don't require the password, then that line is left of.
So it's quite easy to do, but you need to write the sql-batchfile first.
But normally, you just use a server side scripting language to generate the html on the fly, based on the returned recordsets.
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.