jquery - Retrieving value from wordpress database in javascript -


So I have created a table in my database named Inspiration ID and Travel card INT. And added the line with ID = 1 and Visit_Count = 2.

I am trying to retrieve the value in the Visit_Count in WordPress and only display values ​​in the warning for the test.

Ive been following the code code code and this example was used

    

So I made my code

  var $ inspirationWall_Count = 0; $ Inspiration Wall_Count = $ wpdb-> Get_var ($ wpdb- & gt; ready ("SELECT $ wpdb-> inspiration from WHOLE id = 1;););); Warning ($ inspirationWall_Count);   

This value is not retrieved and saves it to $ Inspiration Wall_Count.

What am I doing?

Thank you

You can do this with a PHP with PHP Can not create a warning,

You will be redirected to var $ inspiration valcount = 0; is not required to define because it does not work with PHP,

So here's what you have to do, $ Inspiration Wall_Count = 0 ; $ Inspiration Wall_Count = $ wpdb-> Get_var ($ wpdb- & gt; ready ("SELECT $ wpdb-> inspiration from WHOLE id = 1;););); Echo '& lt; Script & gt; Alert ('. $ Inspiration walcount.') & Lt; / Script & gt; ';

Comments