cmchristian 0 #1 August 4, 2005 I am currently working on my website and would like to incorporate a database into it (i.e. Submit data to the database from the web page and search the database from the web page. I have MS Access. Anyone know how to do this or know of any good online tutorials to do this? Thanks for any help. Chris -------- "Life's journey is not to arrive at the grave safely in a well preserved body; but rather to skid in sideways, totally worn out, shouting 'Holy s#$* what a ride!'" Quote Share this post Link to post Share on other sites
gweeks 1 #2 August 5, 2005 QuoteI am currently working on my website and would like to incorporate a database into it (i.e. Submit data to the database from the web page and search the database from the web page. I have MS Access. Anyone know how to do this or know of any good online tutorials to do this? Thanks for any help. http://www.w3schools.com/ is really good. There are a lot of tutorials and examples. The topics that will help you are Learn SQL, Learn ASP, and Learn ADO under Server Scripting. Quote Share this post Link to post Share on other sites
lummy 4 #3 August 5, 2005 kinda depends on what you're writing the code in, ASP, PHP, Coldfusion,etc. course that also depends on what your server supports. If you're running IIS, you can use ASP. Here's sample code we give our students when they request ASP. down towards the end is some stuff you'll need to edit for it to work DSN is what you called the ODBC connection you created in the ODBC connections. databasename what the database is named. Typically we'll put it in the same dir as the code. Username you set this when you create the ODBC connections password same My First ASP Page <% @LANGUAGE = VBScript %> My First Active Server Page About This Page This web page was created with ASP (Active Server Page) using the Visual Basic Scripting language. It is designed to serve two purposes: it proves that your ASP account is working properly it provides a simple example of how ASP can be used to link web pages to an Access database The table below shows the results of a query run on a sample database in your ColdFusion/ASP folder. The database is very simple; it has a single table containing two fields ("Name" and "Phone Number"). You should see two rows of data in the query output below: Name Phone Number <% Dim objConn,objRS,strQuery Dim strConnection Set objConn = Server.CreateObject("ADODB.Connection") strConnection = "DSN=DSNname;Database=Databasename" strConnection = strConnection & "UID=USERNAME;PWD=PASSWORD;" objConn.Open strConnection strQuery = "SELECT * FROM mytable" Set objRS = objConn.Execute(strQuery) While Not objRS.EOF Response.Write "" & objRS("Name") & "" Response.Write "" & objRS("Phone") & "" objRS.MoveNext Wend %> here's what it looks like sample code I've never done Access with PHP, just Mysql.I promise not to TP Davis under canopy.. I promise not to TP Davis under canopy.. eat sushi, get smoochieTTK#1 Quote Share this post Link to post Share on other sites
cmchristian 0 #4 August 5, 2005 Thanks, this should get me started. The database should be simple. Pretty much a members database. Thanks again for the help. Chris -------- "Life's journey is not to arrive at the grave safely in a well preserved body; but rather to skid in sideways, totally worn out, shouting 'Holy s#$* what a ride!'" Quote Share this post Link to post Share on other sites
Slurp56 0 #5 August 5, 2005 If you are running apache with mysql and decide to go the PHP route, here is an example: // Login information submitted by a form $Login_username = $_POST['luser']; $Login_password = $_POST['lpass']; // Database server login credentials $db_user = 'uName'; $db_pass = 'uPass'; $db_server = 'localhost'; $db_dbase = 'members'; // Connect to the database mysql_connect($db_server, $db_user, $db_pass); // Select the 'members' database mysql_select_db($db_dbase); // Build and Execute a SQL query $db_query = "SELECT * FROM users WHERE u_name='" . $Login_username . "' AND u_pass='" . $Login_password . "'"; mysql_query($db_query); // Close the SQL server connection mysql_close(); ?> The code is pretty simple to use. You can check out the online documentation for PHP at www.php.net or more specifically http://www.php.net/manual/en/ Keep in mind... Any time you store information in a database, especially when you are parsing user submitted information, you need to prepare the user data before running your SQL query. PHP offers its mechanisms in the MySQL 'mysql_real_escape_string()' method. This is important! If I go to log into your website and I put "slurp56'; DROP TABLE 'users';" into the username field, you might have a problem if you arent prepared. Go to google and search for best practices on preventing SQL Injection. Once you get comfortable with database interaction, you'll wonder how you ever lived without it. Another option for storing user login info is an XML document in a locked down directory. Hell, you might even see performance gains in using XML instead of SQL, we did.________________________________________ I have proof-read this post 500 times, but I guarantee you'll still manage to find a flaw. Quote Share this post Link to post Share on other sites
haymangonzo 0 #6 August 5, 2005 QuoteI am currently working on my website and would like to incorporate a database into it (i.e. Submit data to the database from the web page and search the database from the web page. I have MS Access. Anyone know how to do this or know of any good online tutorials to do this? Thanks for any help. Also roam arround: php.resourceindex.com There could be a script freely available to get you up and running. Good luck! *** Nice to meet you toot! Quote Share this post Link to post Share on other sites