dina Posted February 18, 2009 Report Share Posted February 18, 2009 Hi, I want to know a few basic things about using MySQL in a PHP environment, but I don't know where to start: I want to make a form on the website and then save all that info of the form in my db (MS Access) that are ofline on my hard drive. I have a PHP site. Where does MySQL come in on this. Can I link the two and where do I start ? :/ I'm pretty sure it is very easy, I just missing something. Thank you Quote Link to comment Share on other sites More sharing options...
Wickham Posted February 18, 2009 Report Share Posted February 18, 2009 (edited) MySQL is a special type of database which most people use with PHP forms. I've never seen a form linked to a MS Access database. Stefan has some PHP tutorials (links at top right of this page) and I have a basic tutorial here:- http://w ww.wickham43.net/formphptomysql.php but it can get complicated and security issues probably need further coding. The MySQL data can be exported in a number of formats including Excel but I'm not sure if it can be exported to Access but I wouldn't be surprised if it could. Edited February 18, 2009 by Wickham Quote Link to comment Share on other sites More sharing options...
dina Posted February 18, 2009 Author Report Share Posted February 18, 2009 ok, thank you ! Quote Link to comment Share on other sites More sharing options...
sjhwebdesign Posted February 18, 2009 Report Share Posted February 18, 2009 you don't need the access database, the mysql database is used instead(however you can import the access records into a mysql database if your export it as csv and use phpmyadmin to import it into your mysql database. To use a form with a mysql database you need to make a mysql connection: <?php // db settings $db_host = "mysql.yourhost.com"; $db_user = "username"; $db_pwd = "password"; $db_name = "database"; mysql_connect($db_host, $db_user, $db_pwd); mysql_select_db($db_name); ?> you then need to assign a variable to each form feild: You then need to handle the data: <?php if (isset($_POST['Submit'])) { $info = $_POST['info']; mysql_query("INSERT INTO `yourtable` (info) VALUES ('$info')"); } ?> Quote Link to comment Share on other sites More sharing options...
dina Posted February 19, 2009 Author Report Share Posted February 19, 2009 Ok but let me explain what the data base is for: It is for a Recruitment Agency that want's to work ofline with there data most of the time, so do I still have to do it that way? Quote Link to comment Share on other sites More sharing options...
sjhwebdesign Posted February 19, 2009 Report Share Posted February 19, 2009 (edited) you can export / import between mysql and access so you can use access offline and mysql online, however one may not be as upto date as the other etc.. you can't use mysql offline, so you would be limitted to access, which is better used with asp, not php. php and mysql go together but only online. asp and access go together and you can use access offline. HOWEVER: You could run the mysql database for both the customer with the website front end, and have a seperate admin website which is password protected for the company to use the data, however it would require an internet connection. On the other hand if the database is only to be accessed by the company, then you could have you own mysql server and access it locally (you would need to speak to your IT dept about this). either could be done with php/mysql or asp/access, so depends which way you want to do it. Edited February 19, 2009 by sjhwebdesign Quote Link to comment Share on other sites More sharing options...
LSW Posted February 19, 2009 Report Share Posted February 19, 2009 You really do not want to use Access. It is not good for web work. I am in the process of reworking 4 access apps into Oracle/Flex apps. Access is a nightmare. Use MySQL, Oracle or SQL servers. Quote Link to comment Share on other sites More sharing options...
dina Posted February 20, 2009 Author Report Share Posted February 20, 2009 Ok thank you very much for the info. I really appreciate this forum. I just have one last Q, how do I then have to go about understanding this http://www.w3schools.com/php/php_db_odbc.asp. Once again Tanx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.