Current location: Hot Scripts Forums » Programming Languages » PHP » How to get PHP to input data into a MYSQL table?


How to get PHP to input data into a MYSQL table?

Reply
  #1 (permalink)  
Old 04-20-05, 08:26 PM
scl789 scl789 is offline
Newbie Coder
 
Join Date: Mar 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Arrow How to get PHP to input data into a MYSQL table?

Ok i gave up on the imputing data into a access database so i started learning Mysql and php. Now i have my mysql database all set up my tables created and everythign. Now how the heack to i make a form for users to enter stuff and having it go into my mysql database? I went through some of the tutorials but all i was able to find out was how to have a form someone fileld out get e-mail to me. I want it to go directly into the mysql database.Or if i shuld use something other than PHP to make a webpage for people to enter data in a form so it goes into my mysql database

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 04-21-05, 04:19 AM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

I'm afraid you really did no research on this topic, as PHP+MySQL is the most popular stack for web applications. Assuming you know how to get data from a form, you do the following:

mysql_connect('server', 'userName', 'password');
mysql_select_db('dbname');

to insert data:

mysql_query("insert into tableName(field1, field2, ...) values('$value1', '$value2', ...)");

to update data:

mysql_query("update tableName set field1='$value1', field2='$value2', ... where primaryKey=$rowId");

I also assume that you know the relational model of your data. $valueXX should be escaped before going into database.
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 04-21-05, 08:19 AM
scl789 scl789 is offline
Newbie Coder
 
Join Date: Mar 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you like i said im new to all this. this is one of the first places ive been to. I did find one e-book on it but it gave u the stuff to have the data go into the mysql table it dident teach you how to do it thats why im not sure how to do it. Where can i get more info on this stuff?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 04-21-05, 08:24 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
this website has some good tuts:
http://www.php-mysql-tutorial.com/index.php

there are some stuff that are overdone there, but generally it's good
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 04-21-05, 07:24 PM
scl789 scl789 is offline
Newbie Coder
 
Join Date: Mar 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you guys
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 04-21-05, 10:06 PM
stormshadow's Avatar
stormshadow stormshadow is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 355
Thanks: 0
Thanked 0 Times in 0 Posts
queries

just make queries
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when trying to create MySQL table via PHP HasansWeb PHP 5 05-19-11 07:59 AM
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
Php Form + mysql + display data sent needed TheRaider Script Requests 3 10-07-04 02:30 AM
filling HTML table with MySQL data warrerj PHP 1 05-02-04 07:03 PM
Newbie MySQL fccolon PHP 2 03-16-04 11:54 AM


All times are GMT -5. The time now is 12:38 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.