PHP Variable echo and WP-JSON
-
I am building a mobile application and I am trying to use WP REST API for the first time. My apologies if this has been answered many times before but my search brought no results unfortunately.
I have a custom theme page template which has a SQL database call for some information and stores this in an array. It then processes the array and stores all of the array data into independent variables which are then echoed onto the page. This works fine on the website, but when I attempt to grab the variable outputs using the JSON URL, none of the echoed data is shown. I am aware that associative arrays and custom objects cannot be held by the REST API and this is why I stored the outputs into local variables.
Can someone explain why this is not working please?
//Return the details for this month $db=dbConnect(); // Connect to database $thisday = date("Ymd"); $query="select GregDate, aa, bb, cc from aaTimes where GregDate=$thisday"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); $aaSTR=""; while($rs = mysql_fetch_array($result)) { $GregDate=$rs[0]; $Aa=$rs[1]; $Bb=$rs[2]; $Cc=$rs[3]; } echo mysql_error(); dbClose($db); echo "<p>$Aa</p>"; echo "<p>$Bb</p>"; echo "<p>$Cc</p>";Thanks in advance.
The topic ‘PHP Variable echo and WP-JSON’ is closed to new replies.