I want to display values from a MySQL database using PHP. I already have it connected to the database via an external php file. I want it so that it displays the info like, <p> Message: <?php echo *value from database*;?> </p> PHP: How do I do this?
No, seriously. You do NOT have to use mysql_query. In fact, for all that is holy, you should NOT use mysql_query. It's outdated, it will (hopefully soon) be defunct, and should not, in any way, be used. Search for mysqli_ or PDO and use either of those to connect to your database. Here's a few links to get you started: http://www.dreamincode.net/forums/topic/54239-introduction-to-mysqli-and-prepared-statements/ http://codular.com/php-mysqli http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/ The first two are for mysqli, the third one is for PDO