RyanSF07 Posted August 23, 2008 Share Posted August 23, 2008 Hi All, I'm having newbie trouble. All help greatly appreciated, as always. I'm trying to add this: <?php $ratingData = Rating::OutputRating('item'); if (Error::HasErrors()) { echo Error::ShowErrorMessages(); Error::ClearErrors(); } else { echo $ratingData; } ?> to this: $sql = "SELECT video.id...."; $query_result = mysql_query($sql); while ($row = mysql_fetch_array($query_result)) { $content .= " <a class=\"bl\" href = \"quiz.php?id=$row[id]\" target='_self'> $row[title]<br></a>"; } I tried this (below) but it passes the text: $videoID, instead of the actual id. $videoID = $row["id"]; $ratingData = Rating::OutputRating(’$videoID’); $sql = "SELECT video.id...."; $query_result = mysql_query($sql); while ($row = mysql_fetch_array($query_result)) { $content .= " <a class=\"bl\" href = \"quiz.php?id=$row[id]\" target='_self'> $row[title] $ratingData; <br></a>"; } I'm trying to have the $ratingData = Rating::OutputRating('item'); variable pass the id of the quiz in place of 'item'. Please help with suggestions -- are my variables not punctuated correctly? or in the wrong place? THANKS! Ryan Link to comment https://forums.phpfreaks.com/topic/121036-solved-need-help-passing-a-id-from-database-to-variable/ Share on other sites More sharing options...
Sulman Posted August 23, 2008 Share Posted August 23, 2008 Hi, Try removing the quotes when you pass the id: <?php $ratingData = Rating::OutputRating($videoID); ?> Link to comment https://forums.phpfreaks.com/topic/121036-solved-need-help-passing-a-id-from-database-to-variable/#findComment-623944 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.