I have custom table name "backend-member". then i have code how to insert the data into that table using $wpdb.
global $wpdb;
if ( isset( $_POST['save'] ) ){
$wpdb->insert( 'backend-member', array(
'navn' => $_POST['field1'],
'mobil' => $_POST['field2'],
'email' => $_POST['field4'],
'facebook' => $_POST['field3'],
'date_created' => date("M d,Y H:i:s")
),
array( '%s', '%s', '%s', '%s', '%s')
);
header('location:/');
}
and its work to insert the data. and i am trying to query all data using this code, but it doesnt work, no result, even error no appeared, somebody help me how to make this work? thank you. this is my code.
global $wpdb;
$result = $wpdb->get_results ( "
SELECT *
FROM backend-member" );
foreach ( $result as $page )
{
echo $page->id.'<br/>';
echo $page->navn.'<br/>';
}
Thanks in advance