Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 18th, 2007, 06:36 AM
Registered User
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Php transfering data to mysql

hi,
Can you tell me how the input data received from html tags as input will transfer to mysql database.

 
Old December 26th, 2007, 05:22 AM
Authorized User
 
Join Date: Mar 2005
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to pritz Send a message via Yahoo to pritz
Default

Hi gaurava,

I hope you understand the how client server talks and exchange info with each other .
When you post your information the PHP receive it in $_POST superglobal array .In PHP you use we use following LOC to insert data

$con=mysql_connet(username,password,host)
mysql_select_db('databasename')
mysql_query('insert into table(id,name)values(1,$_POST['name'])

This is how data posted from html form is inserted in mysql table.

 
Old January 5th, 2008, 07:33 AM
Registered User
 
Join Date: Jan 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It will be in brief:
$name=$_post['name'];
$phone=$_post['phone'];
$sql="insert into mytable ('name', 'phone') VALUES($name,$phone)";
$result=mysql_query($sql) or die(mysql_error());

Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP-MySQL Insert Data problem forexen PHP Databases 1 March 13th, 2007 12:58 AM
Transfering data from csv file to data base g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 2 May 16th, 2006 11:58 PM
manipulating data in mysql using php - countries phpnukes BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 January 24th, 2005 01:35 AM
Transfering data from one machine to another..... nikosdra SQL Server 2000 0 September 6th, 2003 05:08 AM
Editing MySQL data from a PHP form cmiller Beginning PHP 2 September 2nd, 2003 05:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.