Tag Info

New answers tagged

3

I am not going to give any specific code but I will give you Idea how it can be done without creating any custom database table. I am assuming one driver per truck Algorithm Create two html list, make them sortable. Each list items represents a post type and have ID data field. Once sorting is done get all ids in order. Make two array one contains truck ...


0

Custom field data saved in the wp_postmeta table. Best way to access custom field is using wordpress built-in functions. for example: <?php $mykey_values = get_post_custom_values('my_key'); foreach ( $mykey_values as $key => $value ) { echo "$key => $value ('my_key')<br />"; } ?> 0 => First value ('my_key') 1 => Second value ...


1

Your code looks good though. But Try the following approach - $current_date = $_POST['current_date']; $current_date = date( 'Y-m-d', strtotime($current_date) ); $post_id = (int) $_POST['post_id']; $query = $wpdb->prepare( "SELECT start_date FROM {$wpdb->prefix}booking_history WHERE start_date=%s AND post_id=%d", $current_date, $post_id ); /* ...


0

If for "all the conversations a user is in" you mean "all the conversations where a user has commented" you dont need any additional table, just a SQL to get all the posts of conversation CPT where an user commented. Here a function that should do the trick: /** * Get posts (of a given CPT) an user has commented * * @param int|object|void $user User id ...


1

query - you will get sql as argument of the callback. add_filter('query', 'some_callback_that_change_query'); function some_callback_that_change_query($sql){ remove_filter('query', 'some_callback_that_change_query'); // your banny wrote add_filter('query', 'some_callback_that_change_query'); return $sql; }


0

Export your tables using phpmyadmin interface. Just select those tables only that you want to export from the old database and import those tables in the new database or you can run the command(query) in mysql to copy one table create table newdbname.newtablename like olddbname.oldtablename; INSERT INTO newdbname.newtablename SELECT * FROM ...


0

$wpdb->query("INSERT INTO settings-table (option_name, option_value, option_created, option_edit, option_user) VALUES ('name-1', 'val-1', current_time('mysql'), current_time('mysql'), 'user-1'), ('name-2', 'val-2', current_time('mysql'), current_time('mysql'), 'user-2'), ('name-3', 'val-3', ...


0

I had something similar recently. The context was a store but the model is fairly typical. To greatly simplify, there was a table for Products and another for Serial Numbers (distributed when purchase was completed) to be imported or linked. At first I tried to make Custom Post Types (CPT) fit the model for both. It was fairly easy for Products - I used ...



Top 50 recent answers are included