Jump to content

[SOLVED] Showing data


dark22horse

Recommended Posts

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

<?
$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.