.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Collections >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Fetch data from database to textbox in php

Posted By:satyapriyanayak       Posted Date: February 24, 2014    Points: 40    Category: Collections    URL: http://www.dotnetspark.com  

In this Code Snippets we will know how to fetch data from database to textbox in php.
 

<?php

$con = mysql_connect( 'localhost', 'root', '' );

if( !$con )

{

 die( 'Could not connect: ' . mysql_error() );

}

else

{

 mysql_select_db( 'home_work', $con );

 $result = mysql_query( "SELECT * FROM test" );

 while( $row = mysql_fetch_array( $result ) )

 {

 ?>

 <form>

 <input name="firstname" type="text" value="<?php echo( htmlspecialchars( $row['firstname'] ) ); ?>" />

 <input name="lastname" type="text" value="<?php echo( htmlspecialchars( $row['lastname'] ) ); ?>" />

 </form>

 <?php

}

}

?>



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend