Jump to content

Search the Community

Showing results for tags 'mysql'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 46 results

  1. Hi, Processwire makes efficient use of mysql - every field is a table and field-specific tables are joined on demand. However, joins are used nonetheless, especially in performing queries for $pages->find("selector") and related db-querying selector functions. So queries for $pages->find(field1=value1, field2=value2, field3=value3) will join field_field1, field_field2 and field_field3 tables. In this case, does it make sense to use graph databases (such as neo4j) compared to mysql? With data being connected now more than ever and with all the hype around graph databases and neo4j, will we see a potential support for graph databases in future releases of processwire?
  2. Hey Guys, im quite new in working with CMS. for an project im working on i want to set up an cms. i uploaded and installed processwire onto my ftp. during that there was the "error 2002". the full text was "SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock'" i found out that i have to edit my local sql files.......there are a lot of instructions out there in the www. i have to edit some socket-paths and stuff. and i doesn't work ffs. can anyone help? Im desperate
  3. How can I get the index type of a mysql database table with pw-api? The Following doesn't work. Why? $table = 'pages'; $column = 'pages_id'; $sql1 = $db->query("SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$column'"); $options = array(); while ($row = $sql1->fetch_array()) $options[] = $row; var_dump($options); // return empty array
  4. Hi, im having problem to install PW; "The server requested authentication method unknown to the client ", i can connect normaly with php conection. $link = mysql_connect('moretrealestatecom.fatcowmysql.com', 'db', 'pass'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db('db'); But if i try with PDO return SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client: $dsn = 'mysql:host=moretrealestatecom.fatcowmysql.com;dbname=db'; $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', ); try { $online_dbh = new PDO($dsn, 'morelstatedb', 'pass', $options); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Congratulations!"; } catch (PDOException $e) { echo $e->getMessage(); }
  5. Hello All I am attempting to install my first PW site on GoDaddy hosting using GoDaddy's Web & Classic Linux hosting. All is good with the install up to the point where I created the database. Upon entering the DB Name, User, Pass and clicking continue, I get the following PW error messages: Database connection information did not work. SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Does anyone have any experience with this and know how to correct it? Thanks!
  6. Switching fields like PageTitle to PageTitleLanguage gives errors like: Error: Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_title.data1011' in 'field list' (in /Users/xxx/Sites/xxx/www/wire/core/DatabaseQuery.php line 86) Both admin and frond-end gives this error. Installed (core) modules: Languages Support (1.0.1) Languages Support - Fields (1.0.0) Languages Support - Page Names (0.0.8) Languages Support - Tabs (1.0.8) ProcessWire: 2.3.9 (clean install with the latest dev branch - 0bb84e0d9fdd973376e5bbaaa1e1e4cf4fcc8c5c) PHP version: 5.4.17 MySQL version: 5.6.14 When I try the same files on another MySQL version 5.1.54 the changing works fine. Does anyone knows if this is MySQL related and how to fix this? Thanks!
  7. Hi, on a client website I've enabled error notification and sometimes I receive such mails with this message: Page: http://www.domain.com/?/ User: ? Error: Exception: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 111 (in /kunden/bla/wire/core/ProcessWire.php line 143) What does this mean? Is this normal? Or a kind of hacking attempt? Anything I can do to prevent this? Or just ignore it? ... Thanks Jan
  8. Hello. one of my client site was build with pw 2.3, everything run smoothly until 3 days ago its throwing error (missing templates table). I Checked mysql and the sessions table also missing, any clue what is causing this?
  10. Hello everyone, I'm a PW newbie. Overwhelmed from all I've seen and tried out the last few days. My CMS of choice the last couple of years has been MODX. Other than that, I am working as a frontend and backend developer since over 10 years. Having so much freedom to work directly with PHP inside a CMS / CMF is a relief. No new pseudo scripting language one has to learn (as in Typo3), no unnecessary restrictions or bloat. So, my first general question: If I have an existing dataset in mySQL, that I would like to manage with PW (i.e. inside the admin area of PW) - how would I most likely do that? I know I could export the database tables to PW pages. But what if I wanted a database CRUD system inside the PW area? In MODX "Evo" you could build a custom module for such things. You know - phpMyAdmin is over the top for most clients, and an admin section with a different login and URL is clutter. How can I extend the PW backend? Is it possible to include an off-the shelf CRUD script somewhere? Is that not possible with PW? Or frowned upon? I'm just trying to see what the "best practises" are for these kinds of scenarios. Thanks for explanations, tips and pointers.
  11. Hey all, i wonder if there is a way to imitate an IN() statement like "SELECT id WHERE field IN(1023,1208,2357)" I have a website where i have products assigned to categories, and each product can be assigned to multiple categories. The categories are (of course) pages, so the "categories" field of a product might look like "1034|1209|1508". The pages to display the products are also assigned a category (the products are not displayed on the category pages themselves), but this can only be one at a time. What I am trying to do is to find all products of a category and display them on a page... but I can't figure out how to do that. I tried $pages->find('category='.$page->category); but that didn't work, i think due to the fact that each page can have multiple categories. I would need something like $pages->find($page->category.' in category'); or $pages->find('category has '.$page->category); Is there already a way to accomplish this? Or should I use a completely different approach? Any help is appreciated. Thanks!
  12. Hello, I am relatively new to processwire, but so far it has seemed like a dream come true in regards to a CMS that my clients can actually use. I've setup my project locally and I have done an average amount of development. I want to load the server to a live test account so that my client can see it. I loaded all the files to the server, and I created a mysql database. Did an import, grabbed the database connection information, and would like to use the remote database within my local development environment. So I just changed the config file to fit the information, but it can't connect to the the remote database. Keep in mind this is a MySQL database hosted by godaddy (they always seem to have different rules) The site when loaded on a live test server won't load either. A 500 error is thrown on both accounts. I have double and triple checked that my config information is correct, so I am quite sure that is not the issue(at least when talking about the host, name, user, pass, etc). One thing that I am a little unsure of is does processwire have an issue with MySQL 5.0? Because that is what the database is running on with the Godaddy account. The MySql on my local Xampp server is 5.5.32 and runs fine when using the local database. Could this be the issue? I am going to continue to troubleshoot, and its probably just some error that I am overlooking, but just wanted to reach out to you guys and see if you had any ideas. Thanks!
  13. I am the co-founder of a gaming platform, and I have the fun task of building a new architecture for the entire thing. I am leaning on going with ProcessWire. Would appreciate some help from the community here. I have a question below, and a partnership opportunity. - Would it be technically possible to import a massive database (MySQL) that contains games, info, user info, etc.? I am looking at rebuilding the entire platform but I need to keep the current data as a starting point. On to the next topic. I've spent the last 15 years working in international software business development. (selling and marketing). I used to be a coder, but I'm practically starting from scratch. If there's anyone who wants to collaborate, I would be interested in networking. I have a lot of contacts and could surely get something going with the right partner. My primary objective is to get the aforementioned platform going for now, but once I get a handle on this, I could surely get a multitude of contracts... In fact one of my contacts already went with PW which is how I found out about it. Kal
  14. I did a big beginner mistake. I've deleted MAMP PRO to use XAMPP and in the process of the uninstalation of MAMP PRO I deleted all my databases... Fortunately my projects are already live so I have a working copy on the FTP of my client. I would like to have all this data as it is online so it works local on my computer. This is working with a processwire CMS, the url is http://www.fem-k.com/ if in need... Please let me know how to solve this problem so I can go on playing with processwire on my computer. Thank you very much!!!
  15. I've created a couple pages that hold nothing more than categories - referenced by portfolio pages. The multi-select page fieldtypes work just fine. Now I'd like to find all pages that have category X. Since most items have more than one category, I need selector operators like %= or *=. But these simply don't work. e.g. $cat = $sanitizer->selectorValue($page->title); // works // none of these work: $p = $pages->find("portfolio_categories*=$cat, template=portfolio, sort=-Project_Date"); $p = $pages->find("portfolio_categories%=$cat, template=portfolio, sort=-Project_Date"); $p = $pages->find("portfolio_categories*=$cat"); produce the error messages I've uploaded as attachment below. Do I have a buggy mySQL version installed? Other basic selector queries (foo=bar) work fine...
  16. I m updating an old install of PW onto a new server with latest version of PW. Have changed alot of stuff but am still looking to retain some pages: e.g. all the news children pages. Been trying to use the import from CSV module for this by exporting using mySQL but im not really sure what im doing and I've managed to get an CSV with the page titles but not any content - Is there an easy way to do this? Or does any one have a module or mySQL script to select all the pages with child of id=x in a form they can be imported? Thanks!
  17. This topic is similar to this but wasn't sure whether to post there or start a new thread. I have tried solutions posted there without success. I am trying to use the MySQL pagination feature LIMIT (range results, e.g. SELECT * FROM `your_table` LIMIT 0, 10 ) where I'll limit the actual results returned in a query. I cannot use PW "limit" since that will limit the total number of results returned. I am trying to use the MySQL LIMIT with PW API as follows but I'm getting errors. At the moment, I am trying to query a PW database as follows: $start = 0; $limit = 15; $values = $pages->find("parent=/"."LIMIT". $start ."," . $limit); How do I go about this? Many thanks. This is similar to what Soma does in the module DataTable as follows: $pa = $this->pages->find($selector."start=".$_REQUEST['iDisplayStart'].",limit=".$_REQUEST['iDisplayLength']); In this case he's getting start and limit values from an ajax request (I think). The idea is that more results (pagination) can be loaded on demand. Thanks.
  18. Hello, i need to import a large number of articles from an old site into my PW project. So I wrote an import script which gets the data and for each row, creates a new page in PW and inserts it. So far, so easy. Problems arise because the old DB is latin-1 encoded and I keep getting strange results which are probably due to character encoding. $con = mysql_connect("localhost","yes","also"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_set_charset("latin1", $con); mysql_select_db("mtb", $con); $result = mysql_query('SELECT * FROM stuff'); while($row = mysql_fetch_array($result)) { $new = new Page(); $new->of(false); $new->template = wire('templates')->get('article'); $new->parent = wire('pages')->get('/news/'); $name = wire('sanitizer')->pageName(utf8_encode($row['HEADLINE'])); [*]$new_name = $name; $i = 1; while(isset($found{$new_name})) { error_log('DOPPLER! '.$new_name); $new_name = $name.'-'.$i; $i++; } $found{$new_name} = 1; } Even though I check for double page names, I keep getting the 'Duplicate entry' error. I also tried while(wire('pages')->get("name=$new_name,template=article")->id) {} to find duplicates but it stops with 'Duplicate entry' at a different data set ...I'm confused ... can anyone help? Thanks, thomas
  19. I have a problem with sorting in templates. On my local machine I have IIS with MySQL 5.5.8 and everything works fine (sorting children in admin based on global fields and custom fields (name, title, ...). On my VPS that has MySQL 5.0.95 installed sorting doesn't work at all. I've tried it on another dedicated server that has MySQL 5.1.63 installed and it doesn't work either. Could it be the problem with that version of MySQL's? Sorting in template code (PHP) works fine. Also, I can rearrange children (although sort has been set) and no warning window pops out. On my local machine I get warning that I can't manually rearrange children bacause sorting was set with some particular field. I read this topic and there was sort problem with MySQL 5.0.51. I've installed new PW install on my VPS to confirm that it doesn't have anything to do with project I'm working on, and the sort problem persists.
  20. I stumbled across bad-behavior spam blocker today and I'm trying to port it to Processwire. It looks like a decent service which is natively used in some other cms's and php apps. out of the box, this service is supposed to work by downloading and unzipping the files to somewhere accessible, then adding require_once("/path/to/Bad-Behavior/bad-behavior-generic.php"); To your pages. I added it at the top of PW's index.php. So, its supposed to be working (although I can't yet tell ). However, its supposed to work even better if you can give it a database to enable logging. To do this, one has to add the mysql hooks into the bad-behavior-generic.php file. I think these are the lines that need to be modified: // Bad Behavior callback functions. // Return current time in the format preferred by your database. function bb2_db_date() { return gmdate('Y-m-d H:i:s'); // Example is MySQL format } // Return affected rows from most recent query. function bb2_db_affected_rows() { return false; } // Escape a string for database usage function bb2_db_escape($string) { // return mysql_real_escape_string($string); return $string; // No-op when database not in use. } // Return the number of rows in a particular query. function bb2_db_num_rows($result) { if ($result !== FALSE) return count($result); return 0; } // Run a query and return the results, if any. // Should return FALSE if an error occurred. // Bad Behavior will use the return value here in other callbacks. function bb2_db_query($query) { return FALSE; } // Return all rows in a particular query. // Should contain an array of all rows generated by calling mysql_fetch_assoc() // or equivalent and appending the result of each call to an array. function bb2_db_rows($result) { return $result; } // Create the SQL query for inserting a record in the database. // See example for MySQL elsewhere. function bb2_insert($settings, $package, $key) { return "--"; } // Return emergency contact email address. function bb2_email() { return "example@example.com"; // You need to change this. } // retrieve whitelist function bb2_read_whitelist() { return @parse_ini_file(dirname(BB2_CORE) . "/whitelist.ini"); } // retrieve settings from database // Settings are hard-coded for non-database use function bb2_read_settings() { global $bb2_settings_defaults; $settings = @parse_ini_file(dirname(__FILE__) . "/settings.ini"); if (!$settings) $settings = array(); return @array_merge($bb2_settings_defaults, $settings); } // write settings to database function bb2_write_settings($settings) { return false; } // installation function bb2_install() { return false; } but I couldnt tell how to call the PW mysql hooks. For reference, the sample version for wordpress (bad-behavior-wordpress.php) looked like: <?php /* Plugin Name: Bad Behavior Version: 2.2.3 Description: Deny automated spambots access to your PHP-based Web site. Plugin URI: http://bad-behavior.ioerror.us/ Author: Michael Hampton Author URI: http://bad-behavior.ioerror.us/ License: LGPLv3 Bad Behavior - detects and blocks unwanted Web accesses Copyright (C) 2005,2006,2007,2008,2009,2010,2011,2012 Michael Hampton Bad Behavior is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Please report any problems to bad . bots AT ioerror DOT us http://www.bad-behavior.ioerror.us/ */ ############################################################################### ############################################################################### if (!defined('ABSPATH')) die("No cheating!"); global $bb2_result; $bb2_mtime = explode(" ", microtime()); $bb2_timer_start = $bb2_mtime[1] + $bb2_mtime[0]; define('BB2_CWD', dirname(__FILE__)); // Bad Behavior callback functions. require_once("bad-behavior-mysql.php"); // Return current time in the format preferred by your database. function bb2_db_date() { return get_gmt_from_date(current_time('mysql')); } // Return affected rows from most recent query. function bb2_db_affected_rows() { global $wpdb; return $wpdb->rows_affected; } // Escape a string for database usage function bb2_db_escape($string) { global $wpdb; return $wpdb->escape($string); } // Return the number of rows in a particular query. function bb2_db_num_rows($result) { if ($result !== FALSE) return count($result); return 0; } // Run a query and return the results, if any. // Should return FALSE if an error occurred. // Bad Behavior will use the return value here in other callbacks. function bb2_db_query($query) { global $wpdb; $wpdb->hide_errors(); $result = $wpdb->get_results($query, ARRAY_A); if ( defined('WP_DEBUG') and WP_DEBUG == true ) $wpdb->show_errors(); if (mysql_error()) { return FALSE; } return $result; } // Return all rows in a particular query. // Should contain an array of all rows generated by calling mysql_fetch_assoc() // or equivalent and appending the result of each call to an array. // For WP this is pretty much a no-op. function bb2_db_rows($result) { return $result; } // Return emergency contact email address. function bb2_email() { return get_bloginfo('admin_email'); } // retrieve whitelist function bb2_read_whitelist() { return get_option('bad_behavior_whitelist'); } // retrieve settings from database function bb2_read_settings() { global $wpdb; // Add in default settings when they aren't yet present in WP $settings = get_option('bad_behavior_settings'); if (!$settings) $settings = array(); return array_merge(array('log_table' => $wpdb->prefix . 'bad_behavior', 'display_stats' => true, 'strict' => false, 'verbose' => false, 'logging' => true, 'httpbl_key' => '', 'httpbl_threat' => '25', 'httpbl_maxage' => '30', 'offsite_forms' => false, 'reverse_proxy' => false, 'reverse_proxy_header' => 'X-Forwarded-For', 'reverse_proxy_addresses' => array(),), $settings); } // write settings to database function bb2_write_settings($settings) { update_option('bad_behavior_settings', $settings); } // installation function bb2_install() { $settings = bb2_read_settings(); if (!$settings['logging']) return; bb2_db_query(bb2_table_structure($settings['log_table'])); } // Cute timer display; screener function bb2_insert_head() { global $bb2_timer_total; global $bb2_javascript; echo "\n<!-- Bad Behavior " . BB2_VERSION . " run time: " . number_format(1000 * $bb2_timer_total, 3) . " ms -->\n"; echo $bb2_javascript; } function bb2_approved_callback($settings, $package) { global $bb2_package; // Save package for possible later use $bb2_package = $package; } // Capture missed spam and log it function bb2_capture_spam($id, $comment) { global $bb2_package; // Capture only spam if ('spam' != $comment->comment_approved) return; // Don't capture if HTTP request no longer active if (array_key_exists("request_entity", $bb2_package) && array_key_exists("author", $bb2_package['request_entity']) && $bb2_package['request_entity']['author'] == $comment->comment_author) { bb2_db_query(bb2_insert(bb2_read_settings(), $bb2_package, "00000000")); } } // Display stats? function bb2_insert_stats($force = false) { global $bb2_result; $settings = bb2_read_settings(); if ($force || $settings['display_stats']) { $blocked = bb2_db_query("SELECT COUNT(*) FROM " . $settings['log_table'] . " WHERE `key` NOT LIKE '00000000'"); if ($blocked !== FALSE) { echo sprintf('<p><a href="http://www.bad-behavior.ioerror.us/">%1$s</a> %2$s <strong>%3$s</strong> %4$s</p>', __('Bad Behavior'), __('has blocked'), $blocked[0]["COUNT(*)"], __('access attempts in the last 7 days.')); } } if (@!empty($bb2_result)) { echo sprintf("\n<!-- Bad Behavior result was %s! This request would have been blocked. -->\n", $bb2_result); unset($bb2_result); } } // Return the top-level relative path of wherever we are (for cookies) function bb2_relative_path() { $url = parse_url(get_bloginfo('url')); if (array_key_exists('path', $url)) { return $url['path'] . '/'; } return '/'; } // FIXME: figure out what's wrong on 2.0 that this doesn't work // register_activation_hook(__FILE__, 'bb2_install'); //add_action('activate_bb2/bad-behavior-wordpress.php', 'bb2_install'); add_action('wp_head', 'bb2_insert_head'); add_action('wp_footer', 'bb2_insert_stats'); add_action('wp_insert_comment', 'bb2_capture_spam', 99, 2); // Calls inward to Bad Behavor itself. require_once(BB2_CWD . "/bad-behavior/core.inc.php"); bb2_install(); // FIXME: see above if (is_admin() || strstr($_SERVER['PHP_SELF'], 'wp-admin/')) { // 1.5 kludge #wp_enqueue_script("admin-forms"); require_once(BB2_CWD . "/bad-behavior-wordpress-admin.php"); } $bb2_result = bb2_start(bb2_read_settings()); $bb2_mtime = explode(" ", microtime()); $bb2_timer_stop = $bb2_mtime[1] + $bb2_mtime[0]; $bb2_timer_total = $bb2_timer_stop - $bb2_timer_start; Thanks in advance!
  21. A problem has come up, when I uploaded PW2.2 to a client’s webspace. Everything seems to work fine but one thing: When editing for example the value of a page’s text area, the value which was initially - and successfully - entered and saved, can’t be overwritten by a new value. As I know it worked on my local web server and on other webspaces, I tried to get to the problem’s root. The SQL-query generated to update the field is INSERT INTO `field_team_text` (pages_id, data) VALUES('1074', '11112asdsadasdasa') ON DUPLICATE KEY UPDATE data=VALUES(data) I tested it in phpMyAdmin directly on the database used for the PW2.2 setup. The result is, that the query doesn’t cause any error but also doesn’t update the `data` column for the already existing `pages_id`. As `pages_id` is correctly defined as primary key, I can’t see any reason why this shouldn’t work. The server version is 5.0.37-community-nt, the os may possibly be Windows, as the web server (which isn’t running on the same machine like the database server) definitely is running it. Any ideas?
  • Create New...