php - returning variable from custom table in WordPress (after retrieving from URL) -
I have a code that should capture the Story ID (SID) which is given in the URL and in the end the stories Returns the reference table to get story_name for the SID and then print story_name in the last line of the story. I am close If I do var_dump () I get this message: string (7) "result"
I tried but it does not return anything.
I am also wondering if I am using the table correctly using $ wpdb object if this table is not a table that starts with wp_ (to say this, This is a custom table but it is in the same database).
& lt ;? Php global $ wpdb; // Get CID $ the_SID (isset ($ _GET ['SID']))? $ _GET ['SID']: Wrong; // Story object (for story_name) $ result = $ wpdb-> Get_results ("Where are the stories from the stories from the stories, where are the SIID = $ the_SID"); Var_dump (result); ? & Gt; Article title: & lt; B & gt; & Lt ;? Php echo $ result-> Story_name? & Gt; & Lt; / B & gt;
By default, each custom query returns an object so that you have access to the values Need be This way
$ result-> return-> Your_key;
Comments
Post a Comment