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)" ?> Quote Link to comment 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 />"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.