Retrieving Data From Single Cell In MySQL Table
-
I am writing my first plugin and wish to retrieve a single value from a table created by another plugin.
Their table has six columns named blog_ID, level, expire, gateway, term and amount.
I am interested in using the first three … blog_ID, level and expire. blog_ID and level are numeric values. expire is a unix (or linux) epoch date/timestamp.
I am struggling to display the level associated with a particular blog_ID. Later, I hope to evaluate whether the expire field is greater than the current epoch date/timestamp or not.
In the code below, all goes fine until I try to display the value. My result is showing as ‘ARRAY.’
<?PHP // Testing by Kirk global $blog_id; global $wpdb; $thisblog = $blog_id; echo ('Blog #' . $thisblog); ?>.' is at Level #'. <?php $res = $wpdb->get_results("SELECT level FROM wp_pro_sites WHERE blog_ID = '$thisblog'"); echo $res; ?> <br />
What do I need to do to display the value of the ‘level’ field for a blog with an id equal to the value held in $thisblog?
Thanks in advance!
- The topic ‘Retrieving Data From Single Cell In MySQL Table’ is closed to new replies.