forumnz Posted May 1, 2007 Share Posted May 1, 2007 I really can't figure out whats wrong with this code?? <?php // Make a MySQL Connection mysql_connect("localhost", "designervi_mag", "***") or die(mysql_error()); mysql_select_db("designervi_mag") or die(mysql_error()); // Get all the data from the "example" table $result = mysql_query("SELECT * FROM mag") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo stg1; } ?> Link to comment https://forums.phpfreaks.com/topic/49403-solved-get-data-from-a-db/ Share on other sites More sharing options...
jitesh Posted May 1, 2007 Share Posted May 1, 2007 <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db('foo', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } ?> Link to comment https://forums.phpfreaks.com/topic/49403-solved-get-data-from-a-db/#findComment-242106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.