WordPress : how to fill a table ?
-
Hello,
I have to create a formular which fill a new table on my wordpress database. I have tried to enter data but it doesn’t funtion. This is the code I’ve inserted to a template page (I’ve assigned a page to the template) :
<?php
$mynom = ‘MonNom’;
$myprenom = ‘MonPrenom’;
$myemail = ‘(email visible only to moderators and staff)’;try {
$wpdb->insert( $wpdb->devis, array(
‘nom’ => $mynom,
‘prenom’ => $myprenom,
’email’ => $myemail
) );}
catch (Exception $e) {
echo ‘Exception reçue : ‘, $e->getMessage(), “n”;
}?>
At the begining, I’ve test without the try catch but there wasn’t recording on the db. After, I’ve test with the try catch to see errors messages but nothing is return… What can I do ?
My table is called wp_devis.
At the begining, i’ve put $wpdb->ext_devis but I think tables wp_xxx are queries by $wpdb->xxx and not by $wpdb->wp_xxx
Thanks for your help ;)
-
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
-
I’ve replaced :
$wpdb->insert( $wpdb->devis, array(
‘nom’ => $mynom,
‘prenom’ => $myprenom,
’email’ => $myemail
) );by :
$req = “INSERT INTO wp_devis(id_devis, nom, prenom) VALUES(”,’$mynom’,’$myprenom’)”;
mysql_query($req);Now, it’s good but I don’t use wordpress functions. Any idea about the problem ?
-
-
Yes, they can.
As the bot said, nobody HERE can help you. You don’t have a WordPress.COM blog but a WordPress.ORG blog, and you need to be over there at their forums.
- The topic ‘WordPress : how to fill a table ?’ is closed to new replies.