I'm using the exec php plugin to have php code inside my pages. I've imported a table into the wordpress db and copied my original query over into a page but I can't seem to get it working. I can't tell what's wrong because there is no sql error thrown onto the page all it does is stop executing once it reached the query.
$query = "SELECT * FROM 'classSchedule' ORDER BY 'age' ASC";
$result = mysql_query ($query, $link) or die (mysql_error());
$num_rows = mysql_num_rows ($result);
if ($num_rows != "0")
{
echo "<option value=\"\">Select a Class</option>";
while ($row = mysql_fetch_array($result))
{
$day = $row['day'];
$time = $row['time'];
$class = $row['class'];
$age = $row['age'];
$level = $row['level'];
echo "<option value=\"$day $time $class (Age: $age) Level: $level\">(Age: $age) $day $time $class Level: $level </option>";
}
}
I've also tried testing with example code in the wpdb codex but even that isn't working.
$mylink = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = 10", ARRAY_A);
echo $mylink['link_id']; // prints "10"
Please help!