mysql

retrieve data from multiple tables referencing some tables in mysql

i have 10 tables have innoDB engine 1. one is state_table which attributes are state_id and state_name 2. another table city_table which attributes are city_id and city_name 3. one more table permit_table which attribute is p_id above city_id,state_id and permit_id is references to rest of 7 tables. each table having state_id, cit...

is a mysql temporary table unique for each user accessing the script that creates it...?

Hi everyone... While looking for a way to temporarily save the search results when a user searches for a hotel free between particular dates i came across temporary tables. But certain questions are not answered even in mysql manual.... like... Will the temporary table be unique for each user that executes the script...? Or will it b...

how to repopulate/recreate autoincrement in mysql

I want to know if I can repopulate the autoincrement value in mysql. Because, I have records that look similar: ID Name 1 POP 3 OLO 12 lku Basically , I want a way to update the ID to this ID Name 1 POP 2 OLO 3 lku Is there any way to do this in mysql? Thanks. ...

Inconsistent MySQL COLLATE errors across databases

I have two physically-separate MySQL databases on which I have to run a single query. The query has a section of SQL that looks like this: and foo_table.bar_column like concat('%', rules.pattern, '%') COLLATE utf8_general_ci It runs fine on database A but on database B I get this error: ERROR 1253 (42000): COLLATION 'utf8_general_ci...

MySQL and Collation

I have a table with a column using utf8_unicode_ci character set. This table stores Japanese data and my problem is that using this character set, I'm not able to store the same word written in katakana and hiragana because it's considered to be the same word. For example わたし and ワタシ, which mean I, me. I know that I can change the char...

How do I guarantee row uniqueness in MySQL without the use of a UNIQUE constraint?

Hi I have some fairly simple requirements but I'm not sure how I implement them: I have multiple concurrent threads running the same query The query supplies a 'string' value - if it exists in the table, the query should return the id of the matching row, if not the query should insert the 'string' value and return the last inserte...

PHP MYSQL Add up number of entries in single table and display in HTML

I have a table called activities which contains a number of activities for projects (for example 6 activities are related to one project). On projects page, you can see the projects, and I have one column which needs to display the number of activities associated with the project. So basically, I need a query or PHP calculation that can...

Ajax: distinguish old posts and new posts.

Hi at all, I have created a very simple blog at www.example.com with a only one page. When I connect to www.example.com I see all posts inserted in the database ( in mysql ). Now I want that every 60 seconds an ajax request check in the database if there are new posts. If there are new posts these will be inserted at the top above the o...

How to monitor MySQL query errors, timeouts and logon attempts?

While setting up a third party closed source CMS (Sitefinity) the setup doesn't create all tables and procedures necessary to run it. The software lacks a logging system itself and it made me wonder: could I trace and monitor failing SQL statements from MySQL? This serves more than only the purpose of solving my issue with Sitefinity. M...

MySql - Select from - Don't Show Duplicate Words - maybe "on duplicate key"?

hi, how can I insert "on duplicate key" in this Code to remove duplicate words? or is there a better method that you know? thank you!! this is my code: function sm_list_recent_searches($before = '', $after = '', $count = 20) { // List the most recent successful searches. global $wpdb, $table_prefix; $count = intval($count); ...

mysql and .net: when using tableadapters I’m getting MySqlException “insert command denied for user”, otherwise everything is fine

Hi! I am using mysql as db for my asp.net application. Here are the facts: I am using connection string from web.config which has both username and password. I can do SELECT with tableadapter. When I am trying to do INSERT with tableadapter, I am getting "mysqlexception insert command denied for user" error When I try to do INSERT prog...

index.php gets send as download request on random occasions...

Hello We have had a problem with getting "You want to download index.php/viewtopic.php ect" on our website for quite some time now, and been trying to rule out server load ect. Mainly trying that since it seems to happen mostly when the website has alot of visitors But given that by throttling all apache2 server load settings to lowest...

mysql multiple insert - what happens on error?

What happens in mysql multiple records insert during an error. I have a table: id | value 2 | 100 UNIQUE(id) Now i try to execute the query: INSERT INTO table(id, value) VALUES (1,10),(2,20),(3,30) I will get a duplicate-key error for the (2,20) BUT... Will the (1,10) get into the database? Will the (3,30) get into the database?...

How do I select differing rows in two MySQL tables with the same structure?

I have two tables, A and B, that have the same structure (about 30+ fields). Is there a short, elegant way to join these tables and only select rows where one or more columns differ? I could certainly write some script that creates the query with all the column names but maybe there is an SQL-only solution. To put it another way: Is the...

Displaying name instead of ID PHP MySQL

Hi, I need something simple; I have page where a user clicks an author to see the books associated with that author. On my page displaying the list of books for the author, I want a simple HTML title saying: 'The books for: AUTHORNAME' I can get the page to display author ID but not the name. When the user clicks the link in the previo...

Post High Score and Retrieve Position

I'm not so savvy with MYSQL, so my apologies in advance is this is a dumb question. I've created a super basic PHP High Scores table. Upon inserting a new score into the DB Table, I'd like to retrieve the position of that score so that I can get 10 results with the persons score falling within that range. My INSERT Query looks somethin...

If I use a mysql function in a where clause that returns a static value does it get re-evaluated every row?

For example, select * from x where crc=CRC32('Hi') does the CRC32 function get run every row it checks? If so how could I optimize it? ...

how to use a MySql database within Eclipse

I am very new to programming, so please bear with me, and apologies in advance if at first I dont make sense...! I am doing an undergrad programming project, and need to make some databases within a Java program. I am using eclipse (galilo) to write my program. I have downloaded a connector/J, but havent the foggiest how i should use ...

How do I run a script on/in a mysql database?

I have created a MySQL database using MySQL Workbench. It has about 20 tables. I cannot figure out how to run scripts on the database. Basically, I want to make a database creation script which will allow me to create my database on any other MySQL server. ...

mysql not in my PATH for some reason

I've installed mysql on several macs and on one of them mysql is not in the path. If I export it it shows up in the path correctly, but upon reboot, disappears. What should I do to get the machine to keep it in the path and what are the machines that DO have it in their path doing differently? Any thoughts appreciated. ...