1

Not sure why this will not work? Does the loop not like my variable? If I hard code this workings...

while($row = mysql_fetch_array($resultno))
  {

  echo "<tr>";
  echo "<td><a href=reportip.php?prov=&date1=$date1&starthour=$hour1&endhour=$hour2&prov=$prov&date2=$date2&$hour2&$prov=13&lookup=" . $row['$radio'] . ">" . $row['$radio'] . "</a></td>";
  echo "<td>" . $row['count'] . "</td>";
  echo "</tr>";
  }
1
  • We need to see more code - how are you getting $resultno? Also, are you sure the query is returning any rows? If there aren't any rows returned, your loop will have nothing to loop through :) Commented May 10, 2011 at 13:06

4 Answers 4

5

'$radio' is a string, not a variable. Remove the apostrophes and make it into $radio:

$row[$radio]

This will make it possible to choose a column from the MySQL resultset by setting $radio to the chosen value.

Sign up to request clarification or add additional context in comments.

Comments

0

Your row is not likely to have a $radio key; maybe you meant $row['radio']. Or $row[$radio].

Comments

0

Your array referencing is wrong:

$row['$radio']

should be written as follows, when referencing an array element using another variable

$row[$radio]

or as follows when accessing an element name

$row['radio']

Comments

0

$row['$radio'] seems to be a problem. Is $radio a variable with a value you would like to use as index for the $row then write $row[$radio] otherwise if the table column is named "radio" only write $row['radio'].

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.