Tag Info

New answers tagged


There is a plugin for this. It allows comfortable use of the backend and also replaces the URL in the post-content and some other fields, if you want to: https://wordpress.org/plugins/better-search-replace/


If you can answer 'yes' to the questions in Emetrop's comment, then try: $sql = $wpdb->get_results('SELECT * from table1 WHERE id = $bransId');


You can also try below code to retrieve count of rows. $myquery = $wpdb->get_results( "SELECT * FROM tablename WHERE ID='some-value'" ); echo $wpdb->num_rows; Let me know if you have any problem. cheers


The Problems You risk SQL injection, with your current setup: $wpdb->users.display_name LIKE '$ltr%' The following could also be a problematic part in your SQL query: AND $wpdb->usermeta.meta_value = %artist% i.e. using = instead of LIKE. You're also missing the quotes: %\"artist\"%, to exclude e.g. bartist or fartist ;-) But you don't need ...


If always escaping input like: post, get, request, cookie SQL injection are not possible. $input_var=mysql_real_escape_string($input_var); or more good this function: function doEscape($str) { return get_magic_quotes_gpc() ? mysql_real_escape_string(stripslashes($str)):mysql_real_escape_string($str); }


Usually you only have to use mysql.domain.com if connecting to a remote database. If that is what you are doing, then yes. It will be slower than a locally hosted database. Even if the domain resolves to the local server localhost should resolve quicker as it uses the loopback interface which bypasses network hardware.


if you want to keep the row with the lowest id value: DELETE n1 FROM table n1, table n2 WHERE n1.id > n2.id AND n1.meta_key = n2.meta_key OR if you want to keep the row with the highest id value: DELETE n1 FROM table n1, table n2 WHERE n1.id < n2.id AND n1.meta_key= n2.meta_key


I am not sure where you got that export code but I don't see the PRIMARY KEY defined as it should be. Take a look at the code from Core that creates the table: 87 CREATE TABLE $wpdb->commentmeta ( 88 meta_id bigint(20) unsigned NOT NULL auto_increment, 89 comment_id bigint(20) unsigned NOT NULL default '0', 90 meta_key varchar(255) default ...

Top 50 recent answers are included