How To Connect A Textbox To A Database In Php Using Ms Access?
I have an order form desined in php. To use it I need to connect it to a database. I use Yahoo hosting service. My website is www.ibexstudents.com. It has no support for asp but supports php, javascript and perl. Any other innovative approaches are welcomed.
Please give me the full procedure as I am not very good at programming. Thank you.
Related posts:
- How Do You Connect To A Mssql Database Using Php? I want to connect to a MSSQL database using PHP...
- How To Connect Mysql Database With Flash Via Php? I want to connect my fla file with mysql database...
- mysql connect to a database function Learn more about mysql connect to a database function by...
- create a Microsoft Access database Learn more about create a Microsoft Access database by visiting...
- Display an Access database Learn more about Display an Access database by visiting our...
Related posts brought to you by Yet Another Related Posts Plugin.


May 2nd, 2009 at 11:29 pm
Assuming you have odbc driver , and dsn registered on your webserver, this is how you do it.
< ?php
$db='your databse name';
$usrname='username';
$pwd='your password';
$conn = odbc_connect($db,$usrname,$pwd);
?>
Now let us assume you want to update your database with something that user inputs in your text box, lets say his Display name on your website, and password.
Lets assume textbox for name is txtname and for password (type=”password” for asterics) is txtpass.
When user clicks on submit (name btnsubmit), lets say this info should be updated in a table called User in your database $db. Also assume form method is post and action is on same page (example newuser.php)
< ?php
if(isset($_REQUEST['btnsumbit']))
{
$query="insert into table User values('".$_REQUEST['txtname']."','".$_R...
odbc_exec($conn,$query);
?>
}
Ofcourse this code dont handle any errors/exceptions and if u want to fetch data from database. u can use method
$recordset=odbc_exec($conn,$query);
odbc_fetch_row($recordset);
where query could be something like select * from User.
Good Luck!