Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » eCommerce & Atahualpa »

Write to a database table


  #1  
Old Feb 4, 2010, 03:42 AM
joan
 
50 posts · Sep 2009
Brisbane, Qld, Aust
Hi JuggleDad
I am using Simple Paypal Shopping Cart, but I need to collect some extra client info before they check out. Into the Simple php file which displays the checkout page, within a form, I added two input boxes, as below:
`<form action="http://www.travelhorizonstyle.com.au/wp-content/cust-write.php" method="post" name="book"><input type="text" size="10" value="" name="First"><br><input type="text" size="10" value="" name="Last"><input type="submit" value="NEXT"></form>';`

Into the cust-write.php file I have tried various methods to get these two fields to be written to the database, without success as I keep getting an error about and invalid object... The variations are commented out below:

`<?php
function save() {
global $wpdb;
$key1 = "user_login";
$key1 = "user_nicename";
$First = $_POST['First'];
$Last = $_POST['Last'];
$result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->customers} ( user_login, user_nicename ) VALUES ( %s, %s )", $First, $Last ) );
//$wpdb->insert( 'table', array( 'column1' => 'value1', 'column2' => 123 ), array( '%s', '%d' ) )
//$wpdb->insert( $wpdb->customers, array( user_login => $First, user_nicename => $Last ) );
//$wpdb->query( $wpdb->prepare( " INSERT INTO $wpdb->customers ( $key1, $key2 ) VALUES ( %s, %s )", $First, $Last ));
//$wpdb->query( $wpdb->prepare( " INSERT INTO $wpdb->customers ( user_login, user_nicename ) VALUES test, tester ));
//$wpdb->query("INSERT INTO $wpdb->customers VALUES(" .$First .",". $Last . ")");
$wpdb->flush();
//Parse error: syntax error, unexpected T_OBJECT_OPERATOR i
//Call to a member function insert() on a non-object in..line 7
//Call to a member function query() on a non-object in.. line 8
//return $result;
}
?> `

Can you or any of the wonderful friends of Atahualpa give me suggestions as to why it will not write the the database table 'customers' ??

Kind regards,
Joan.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving WP blog to new domain--not sure what to do with database?? kmagyarics Web Hosting for WordPress 5 Mar 2, 2011 11:07 AM
Need help to write and save in pages. gladiator Customization, Design, Programming... 14 Dec 9, 2009 06:38 AM
v3.3.2 Everywhere "Write a comment" but not activated bg74blogger Comments, trackbacks & pings 24 Sep 29, 2009 08:59 AM
Table Issues bobby sapphire Atahualpa 3 Wordpress theme 2 Aug 11, 2009 07:01 AM
reinstall Atahualpa with Options with access to old database grasshopper Installing & running WordPress 1 Aug 8, 2009 05:52 AM


All times are GMT -6. The time now is 02:49 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.