syedkhajafairoz Posted February 25, 2012 Share Posted February 25, 2012 I want to create a manual function for insert query of registration form, please help me to do it, and explain in easy method. Link to comment Share on other sites More sharing options...
astralaaron Posted February 25, 2012 Share Posted February 25, 2012 well first you connect to mysql with something like this: mysql_connect(DBHOST,DBUSER,DBPASS) then select your database mysql_select_db(DEFAULTDB) you can put it into a function to keep it organized and easy to re use: function connection($dbhost,$dbuser,$dbpass,$dbdefault) {$connection = mysql_connect($dbhost,$dbuser,$dbpass) or die('Cannot connect to mysql '.$dbhost.' '.$dbuser.' '.$dbpass.');if(!mysql_select_db($dbdefault)) die('problem selecting database '.$dbdefault);return $connection;} then make your insert query with all your fields.. $query = "INSERT INTO `table` (`field1`,`field2`,`field3`) VALUES ('$info1','$info2','$info3') "; and run it $exe = mysql_query($query); then check if there was a problem if(!$exe){ echo('got problems ' . $query);} I always found the easiest way to figure out any problems is to echo out the bad query and try to make it right in phpMyAdmin... then correct the php Link to comment Share on other sites More sharing options...
justsomeguy Posted February 25, 2012 Share Posted February 25, 2012 There's also a thread that includes registration here: http://w3schools.invisionzone.com/index.php?showtopic=12509 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.