View Full Version : mySQL connection with Dreamweaver/Frontpage
Running XP Pro... Using mySQL/PHP and running both Dreamweaver and Frontpage. Trying to figure out what is the best program to use and the best way to connect to mySQL...Any help would be greatly appreciated...
08-21-2006, 02:03 PM
I'm running XP Pro and I have both Dreamweaver and Frontpage 2003, too. And I tell you Dreamweaver is much better than Frontpage, especially the version I have(MX). When you're saying which is the best way to connect with MySQL, what do you mean? The best code to do so or how to put the code togother to be easier to read(and so easier to find errors).
The code I use to do so is:
<? /php open tag
$conn = mysql_connect("somehost", "username", "somepass"); /function to connect to MySQL
mysql_select_db("somedatabase", $conn); /function to select database from MySQL
$sql = "CREATE TABLE testTable (id int not null primary key auto_increment, testField varchar(100))"; /construction of the command of MySQL
$sql_res = mysql_query($sql, $conn); /execution of the command
?> /php end tag
Now, as for how to put the code together:
It's good to create your own functions. For example, create one function that connects to MySQL and selects one database. Here's an example:
function doDB() /function that connects to MySQL and selects a database
$conn = mysql_connect("somehost", "username", "somepass");/connection to MySQL
mysql_select_db("somedatabase", $conn); /selection of a database
function CreateTable($tablename) /function that creates a table in a database with the name given from the user
$sql = "CREATE TABLE $tablename (id int not null primary key auto_increment, testField varchar(100))";
$sql_res = mysql_query($sql, $conn);
/calling of the functions
However, there a lot to learn about MySQL and PHP. Here's a book that helped me A LOT:
Teach Yourself PHP, MySQL and Apache, All In One - Julie C. Meloni (A really good book)
Also, I have two other books in PDF and some other tutorials - Give me your email to send you that information.
Hope I Helped!!!!:D
01-30-2007, 11:52 AM
I am a bit new with web, is it possible to use frontpage while the host have mySQL and frontpage extension ? I would appreciate if you could send me all info to my email. Thanks before
01-30-2007, 03:10 PM
OK, Herry, I'll send them to you!
01-30-2007, 03:16 PM
Just be warned about Frontpage AND Dreamweaver. Both will add things to your scripts/pages, and sometimes you will never notice, other times your items will not work.
If you do not know how to code this all by hand yourself, then you won't be able to fix the problems (when and if they arrive).
I don't endorse either, but I know a lot of people learn by using them, so I don't hate them either. I just suggest you learn how to do it in a plain text editor (like notepad, etc).
If you can understand enough to do that much then you can easily understand the "extras" that DW and FP put in there, and thus, how to correct them.
Powered by vBulletin® Version 4.2.1 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.