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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.