Technology, Web & Business Forum

You are here: Technology, Web & Business Forum : Web Development : Programming : How to connect a textbox to a database in php using ms access?


Welcome to the Technology, Web & Business Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.


Programming Discuss programming languages such as .NET, PHP, PERL, ASP, ColdFusion, C++


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-18-2009
Junior Member
 
Join Date: Mar 2009
Posts: 3
Default 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 Ibex Students. 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.
Reply With Quote
  #2 (permalink)  
Old 02-12-2010
Junior Member
 
Join Date: Feb 2010
Posts: 3
Default hai

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!
__________________
football games
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 06:58 PM.