0

I am using a theme that i installed and activated in wordpress .The theme is Zerif-lite.

I added a table to the database named "doctors" with 2 attributes "id" and "name". What I'm trying to do is to select all data in this table. I've used the following code but nothing is displayed

$mystuff = $wpdb->get_row("SELECT * FROM doctors WHERE 1);

Any Help??

2 Answers 2

1

try this

global $wpdb;
$result = $wpdb->get_results("select * from `table_name` where column = value");
foreach($result as $results){
  echo $results->field1;
  echo $results->field2;
}
Sign up to request clarification or add additional context in comments.

Comments

0

try this:

global $wpdb;
$result = $wpdb->get_results("select * from `table_name`");
foreach($result as $row){
echo $row->field1;
echo $row->field2;
echo $row->field3;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.