PDA

View Full Version : Need help Integrating SQL with a HTML page


Dreamkeeper
09-06-2002, 02:50 PM
If someone knows how to do this, or has a script that will help me integrate an SQL database and HTML, I would greatly appreciate it.

boris
09-06-2002, 03:04 PM
I don't think you can access a SQL database directly from HTML. However, you can use a scripting language like PHP (http://www.php.net), which is also very good documented.

Admin
09-06-2002, 08:36 PM
PHP is good for accesing mySQL databases, and ASP is used to access Ms Access/SQL/Oracle databases. (I think) ;)

-TheDarkEye-
09-07-2002, 04:48 PM
Originally posted by Admin
PHP is good for accesing mySQL databases, and ASP is used to access Ms Access/SQL/Oracle databases. (I think) ;)

your choice of scripting language and database is very much independent as long as the correct database drivers are availible.

in other words... php, asp, coldfusion, jsp, ect... should all work just fine with access, mysql, sql server, oracle, postgresql, ect...

of course, there are a few combinations of the above that are more common that the others. php+mysql, for example.

-TheDarkEye-
09-07-2002, 06:10 PM
i just wanted to make it clear that those combinations werent nessesarily more common because they are better combinations.

php and mysql do work together quite well but i think they are common combo's just because they are both easy to use, free, and very platform independant.

asp and access/sql server are common combinations because they are all made by the same company and they only run on that companies os platform.

you see where im going with this.

EnwTheGood
09-08-2002, 07:36 AM
BTW, I strongly reccomend phpMyAdmin (http://www.phpmyadmin.net/) for your online mySQL-administering needs. It keeps getting better every day.

-TheDarkEye-
09-08-2002, 03:45 PM
i think he would appriciate phpmyadmin much more if he actualy learned how to use the mysql admin tools first.

terry68102
10-18-2002, 01:06 PM
The best way to use SQL and VBScript (I can tell you from recent experience that integrating JavaScript with VBScript and SQL is NOT a good idea!) is to simply use an index.asp instead of index.html, for example. Evrsoft 1stPage has NO problem handling an ASP. I have created a dozen ASP for a complicated web site for SITEL Corp. The Database (Access, SQL on Windows 2000 server) stores records with many fields including MEMO fields. I have found that it is best to use VBScript instead of JavaScript to manipulate strings for searches. I just finished an application where I had to search for an item in all fields of all the records where each record represents a Service Level Agreement document. Then the code had to mark all matchs found in red text and display the results.

I tried JavaScript but it was not reliable. So I switched to VBScript and it is reliable. VBScript is said to handle strings better, anyway.

In summation, just use ASP not HTML. The spiders find INDEX.ASP as fast as they find INDEX.HTML as they have on my web site http://www.alarmuers.com

You could try <!-- #Include File="special.asp" --> to access your database but I have not tried it so I do not know if that would work.

terry68102
10-29-2002, 06:49 AM
The best way to handle a database is to use ASP with VBScript such as the following:

<%
DIM productID
productID = 34
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "accessDSN"
Set RS = Server.CreateObject( "ADODB.Recordset" )
RS.ActiveConnection = Con
RS.CursorType = 3
RS.Open "SELECT FROM the_table WHERE the_id=" & productID
IF NOT RS.EOF THEN
productName = RS( "product_name" )
END IF
RS.Close
Con.Close
%>

The above VBScript always runs at the server to permit database access. The above code is shown on pages 109-110 of "SAMS Teach yourself E-Commerce Programming with ASP" which is my favorite little helper. The file must be "thefile.asp" type for the code to work.