Alka-Seltxer Posted July 1, 2008 Share Posted July 1, 2008 I was wondering if a php file could get a value from mysql like below? I would have searched the forum first, but I'm new to php and mysql and I don't have a clue what to search for. Example: <?php //Clips $welcome = "(value from mysql here)" ?> Link to comment https://forums.phpfreaks.com/topic/112698-php-and-mysql/ Share on other sites More sharing options...
br0ken Posted July 1, 2008 Share Posted July 1, 2008 By your post it seems you literally are 100% new to PHP and MySQL. While I agree with learning by doing, I think first you need to read up on some basic theory. With that said, here's some basic code to retrieve values.... <?php // Assuming you're already connected to the DB $res = mysql_query("SELECT id, name, price FROM tblProduct ORDER BY name ASC"); while($row = mysql_fetch_assoc($res)) { echo $row['name']."<br />"; echo $row['price']."<br /><br />"; } ?> Link to comment https://forums.phpfreaks.com/topic/112698-php-and-mysql/#findComment-578770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.