Hi!
Sorry but I am very new to this stuff and am aware this could be a very complicated way of using a database but I am just tryng to learn how to make use of MySQL as best I can manage.
Basically I have a database which holds a list of quotes numbered 1-100 and the user can rate this quotes with 0-5 stars. I have set up the voting system which when a user clicks a link the php collects the variables of the quote number and the star rating. There is then another database which holds the users unique ID number and field numbered 1-100, one for each quote. When the user has selected a vote option the code should check this voters database to see if the quote number selected has already been voted for but as this depends on the user option the field to check varies with each vote.
Currenty I have this section of code:
$dataname = mysql_query("SELECT * FROM voters WHERE uid = $user") or die(mysql_error());
//Now we loop through all the data
while($ratingsname = mysql_fetch_array( $dataname ))
{
//Echo "<br>";
//This outputs the rating
Echo "You rated this as ".$ratingsname['$id']."";
The last part is the section I believe is the problem ".$ratingsname['$id']." I think that this is the way to chose the field to display but I can only get it to work when the field is not variable ie "$ratingsname['5']."
Is there a way where I can use a variable?
Thanks
Chris