Below example will do the insert data into mysql database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<?php $databasehost = 'localhost'; $databaseuser = 'root'; $databasepassword = ''; $connection = mysql_connect($databasehost, $databaseuser, $databasepassword); if(! $connection ) { die('Could not connect: ' . mysql_error()); } $sqlqry = 'INSERT INTO mydoubts_data '. '(id,name) '. 'VALUES ( "hello" )'; mysql_select_db('mydoubts_data'); $output = mysql_query( $sqlqry, $connection); if(! $output ) { die('Could not enter data: ' . mysql_error()); } echo "Entered data successfully\n"; mysql_close($connection); ?> |