Jump to content

news in a row?


Boxerman

Recommended Posts

Hi guys..

 

 

ive got a music site and would like to add 3 different things

 

like this...

 

my.php?image=3inarowad8.jpg

 

so the first one would be featuredartist 2nd most requested song.. and 3rd number 1 song that week..

 

ok.. i will have 3 different databases...

 

and 1 called featuredartist 2nd mostrequested 3rd topsong

 

so i will enter the data into each database..

 

such as image link and text..

 

my problem is.. how do i grab it from the database?

 

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/136733-news-in-a-row/
Share on other sites

<?php 

//Puts all the required MYSQL database info into variables
$host = "host here"; 
$username = "username here"; 
$password = "password here"; 
$dbname ="database name here"; 

//connects to the MYSQL database with the information provided above
mysql_connect($host,$username,$password) or die(mysql_error()); 

//Selects the database name
mysql_select_db($dbname); 


$getfeaturedartist = mysql_query("SELECT * FROM featuredartist"); 



while($artist = mysql_fetch_array($getfeaturedartist)){

$featured = $artist['featuredartist']; //this grabs whatever is in the field featuredartist, and puts it into a variable

} 

echo "Today's featured artist is:".$featured."<br />"; 

?>

 

think your looking for something like that. please note this code has not been tested.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/136733-news-in-a-row/#findComment-714085
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.