mortrza1371
Forum Replies Created
-
Forum: Plugins
In reply to: [MasoomShahid] ???? ???? ?? ?????Forum: Hacks
In reply to: Insert and then update post_type by wp_update_postfunction wp_emallmobnok(){ $postdater = parsidate('j / F / Y',$datetime='now',$lang='pre'); $postdate = date('Y-m-d H:i:s'); $ta = parsidate('j / F / Y',$datetime='now',$lang='pre'); $postdate_gmt = date('Y-m-d H:i:s'); $titles="price daily"; $posts = array( 'post_content' => $oiobz1, 'post_name' => $titles, 'ID' => 115, /// ID of page 'post_title' => $titles, 'post_type' => 'page', 'post_status' => 'publish', 'post_author' => '6', 'ping_status' => 'open', 'post_date' => $postdate_gmt, 'post_category' => array(188), 'tags_input' => " price", ); $post_id = wp_insert_post($posts);//// instert post add_post_meta( $post_id, ' wp_insert_post', 0, true ); $post_up = wp_update_post($posts);///update post add_post_meta( $post_id, ' wp_update_post', 0, true ); }
I fixed. I add ID of the page and working (updating)
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandI fix
Forum: Everything else WordPress
In reply to: Wp_Schedule_Event every day at specific timeok.
I want start every day at 01:28:00 AM,
But I don’t know How add this task to wp_schedule_event..
In Follwing web site I convert
28 Mar 2015 13:43:24 GMT to UNIX timestamp format
https://www.epochconverter.com/
Now I’m stuck in this issue..
Forum: Everything else WordPress
In reply to: $wpdb->replace Can't replace value of tableNow I add id in query
But cant update id
$wpdb->replace( $wpdb->prefix . 'fafa', array( 'id', 'title' => trim($row->item(0)->nodeValue) , 'liveprice' => trim($row->item(2)->nodeValue) , 'changing' => trim($row->item(4)->nodeValue) , 'lowest' => trim($row->item(6)->nodeValue) , 'topest' => trim($row->item(8)->nodeValue) , 'time' => trim($row->item(10)->nodeValue) ), array( '%d', '%s', '%s', '%s', '%s', '%s', '%s' ) );
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandSurely there is one answer for each question.
I wrote the code. It was something that came to my mind.Can we use ‘replace’ instead ‘update’?
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandoh
Th top code haven’t very problem.only problem in code is can’t updating data and only insert
The top code is contain following code witch I want insert then update my fields ..
$wpdb->insert( $wpdb->prefix . 'wp_coin_price', array( 'title' => trim($row->item(0)->nodeValue) , 'liveprice' => trim($row->item(2)->nodeValue) , 'changing' => trim($row->item(4)->nodeValue) , 'lowest' => trim($row->item(6)->nodeValue) , 'topest' => trim($row->item(8)->nodeValue) , 'time' => trim($row->item(10)->nodeValue) ), array( '%s', '%s', '%s', '%s', '%s', '%s' ) );
I inserting full source code for you until you see my full code and then Consider my code on your WordPress ..
If run my code you can see in the database table only insert values and not updating
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandI am the developer of this plugin
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandOH. following is my full source code .
following code get price with curl and then insert in to the database . please test on your wordpress
* Plugin Name: Fars-coin Plugin URI: # Version: 1.1 Author: Morteza Description: coin License: GPL v2 - https://www.gnu.org/licenses/old-licenses/gpl-2.0.html License: ============================================================================== Copyright 2014-2015 pluginha (email : [email protected]) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ add_action( 'plugins_loaded', 'ggggg_into_db', 1 ); function ggggg_into_db(){ $ch = curl_init ("https://widgets.farsnews.com/currency/"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8'); $page = curl_exec($ch); $dom = new DOMDocument('1.0', 'utf-8'); libxml_use_internal_errors(true); $dom->loadHTML($page); libxml_clear_errors(); $xpath = new DOMXpath($dom); $data = array(); $table_rows = $xpath->query('//div[@id="coin"]/table/tr[@class="tblBody"]'); // target the row (the browser rendered <tbody>, but actually it really doesnt have one) if($table_rows->length <= 0) { // exit if not found echo 'no table rows found'; exit; } global $wpdb; foreach($table_rows as $tr) { // foreach row $row = $tr->childNodes; if($row->item(0)->tagName != 'tblhead') { // avoid headers $data[] = array( $trip ['Name' ]= trim($row->item(0)->nodeValue), $trip['LivePrice'] = trim($row->item(2)->nodeValue), $trip ['Changing']= trim($row->item(4)->nodeValue), $trip ['Lowest']= trim($row->item(6)->nodeValue), $trip['Topest']= trim($row->item(8)->nodeValue), $trip['Time']= trim($row->item(10)->nodeValue), ); } } foreach($table_rows as $tr) { $row = $tr->childNodes; if($row->item(0)->tagName != 'tblhead') { $wpdb->insert( $wpdb->prefix . 'wp_coin_price', array( 'title' => trim($row->item(0)->nodeValue) , 'liveprice' => trim($row->item(2)->nodeValue) , 'changing' => trim($row->item(4)->nodeValue) , 'lowest' => trim($row->item(6)->nodeValue) , 'topest' => trim($row->item(8)->nodeValue) , 'time' => trim($row->item(10)->nodeValue) ), array( '%s', '%s', '%s', '%s', '%s', '%s' ) ); } } }
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandBug #3221
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandyes . don’t display any massage . I think $query = $wpdb->prepare… not running
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandbut don’t display any massage of SQL
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE command$query = $wpdb->prepare ("INSERT INTO ".$wpdb->prefix."fafa ( title, liveprice, changing, lowest,topest,time) VALUES (%s, %s, %s,%s, %s, %s) ON DUPLICATE KEY UPDATE title = %s, liveprice = %s, changing = %s , lowest = %s, topest = %s, time = %s", 1, trim($row->item(0)->nodeValue), trim($row->item(2)->nodeValue), trim($row->item(4)->nodeValue), trim($row->item(6)->nodeValue), trim($row->item(8)->nodeValue), trim($row->item(10)->nodeValue) ); echo "<p>".$query."</p>";
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandplease send your email to me I want send full my source code to you
Forum: Plugins
In reply to: Update all fields of table with ON DUPLICATE KEY UPDATE commandwhen I add echo “<p>”.$query.”</p>”; under my code and run plugin ..
don’t display any massage