dark22horse Posted April 21, 2007 Share Posted April 21, 2007 Hi guys, I have been struggling to retreive any data from mysql database and then show it on a webpage. I will post the script below. Any help would be appreciated!!! <? $username="root"; $password=""; $database="car"; mysql_connect(localhost,$username,$password); mysql_select_db($database) or die( "Unable to select database"); $sql = "SELECT * car"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)){ echo $row['name'].'<br />'; echo $row['description'].'<br />'; } ?> I want to format it, but that can wait until I actually get something!!!! Link to comment https://forums.phpfreaks.com/topic/48001-solved-showing-data/ Share on other sites More sharing options...
fert Posted April 21, 2007 Share Posted April 21, 2007 <? $username="root"; $password=""; $database="car"; mysql_connect("localhost",$username,$password); mysql_select_db($database) or die( "Unable to select database"); $sql = "SELECT * FROM car"; $query = mysql_query($sql) or die(mysql_error());; while($row = mysql_fetch_assoc($query)){ echo $row['name'].' '; echo $row['description'].' '; } ?> Link to comment https://forums.phpfreaks.com/topic/48001-solved-showing-data/#findComment-234585 Share on other sites More sharing options...
dark22horse Posted April 21, 2007 Author Share Posted April 21, 2007 hi guys! Im a complete noob I have hopefully got it working, I saved it as a html file, saved as a php and everything worked Link to comment https://forums.phpfreaks.com/topic/48001-solved-showing-data/#findComment-234752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.