mysql

are MySQL INSERT statements slower in huge tables?

I can see how SELECT and UPDATE statements get slower as a table grows and grows, but what about INSERT ? ...

Doing an SQL query in PHP where a field from a different table is referenced.

OK, In this query I am displaying the sales for a particular person, matching the passport number from the current form I am working on. What I want to do however, is to sum the total sales and display it, excluding records which have been marked as paid. I am having trouble because "paid" does not existent in the current form I am wo...

mysql_fetch_array for boolean fields?

I have a boolean field, which seems to be stored as 1 when true. When trying to grab that field in a while loop, I get the error: mysql_fetch_array() expects parameter 1 to be resource, boolean given Should a boolean be stored as "TRUE" instead of "1"? Otherwise, why would I be getting this error? edit: My code: $sqltotal = mysql_...

Error Code: 1136 Column count doesn't match value count at row 1) inside sp

Dear all, i have some troubles filling a predefined table with a stored procedure. mytable has 6 fields: uid,testrun,exp1,exp2,exp3,weightedvalue where uid is an autoincrement PK. My sp contains an insert statement like: CREATE PROCEDURE test (IN testrun INT) BEGIN .... some declare statements ... INSERT INTO exp_factors(testrun,e...

parsing user-typed Full Text Search queries into WHERE clause of MySQL using PHP

I want to convert user typed FTS queries in to MySQL's WHERE clause. So the functionality will be something like Gmail's search. So users will be able to type: from:me AND (to:john OR to:jenny) dinner Although I don't think it is important, the table structure will be something like: Message - id - from - to - title - descriptio...

How to select two seperate non-overlapping tables in MySQL.

Hi there. I'm looking for a query to select rows from two different tables, keeping the column names the same (I did find one result here for selecting from two different tables, but it merged the column names to have an easier query). I need to keep the original column names, but have two different tables existing within the new, larger...

Summing a field while excluding certain fields in SQL

I am trying to suma column in a table, while excluding certain records that have the paid field set to true. I am doing so like this: SELECT SUM( cost ) AS total FROM sales WHERE passport = 'xxxxx' AND paid <>1 The table is full of data, and I can display costs by themselves, or the entire total. Just adding on AND paid <>1 Is w...

Exception of type 'System.OutOfMemoryException' was thrown

Hi I have an application which throws "Exception of type 'System.OutOfMemoryException'". Which reduces the performance of the server,the CPU usage was around 95%. I dont know the reason why this problem is occuring .... can any one pls tell wats the reason for the error and how can i sort it out???? This is my stack trace: ...

How to parse values from database

EMAIL EML_GRP ------- ----- [email protected] 1,2,3 [email protected] 1,4,5 This is the table structure. How do I parse the values in the EML_GRP field? I am using mySQL. ...

phpmyadmin: data is not importing correctly for varchar(utf8_bin)

I installed latest mysql and phpmyadmin 3.3.2deb1 on ubuntu. When I import already created sql file of data then it store garbage data (for example: 416e746967756120616e642042617262756461) for varchar field but all other fields are successfully imported. When I used same file before latest installation then it was importing data correctl...

mysql_fetch_object() or mysql_fetch_array() which is better and why?

mysql_fetch_object() or mysql_fetch_array() which is better and why? ...

Find rows that has ALL the linked rows

I've got two tables: User (id, name, etc) UserRight (user_id, right_id) I want to find the users who have rights 1, 2 and 3, but no users who only have one or two of these. Also, the number of rights will vary, so searches for (1,2,3) and (1,2,3,4,5,6,7) should work with much the same query. Essentially: SELECT * FROM User WHERE ( ...

google site search to list my database content

I am in the process of deciding which engine to use to incorporate extensive search features on my database entries into my site. I have been suggested Zend_Lucene, but am debating between Google Site Search. The question I forgot to ask was will Google Site Search provide me with database searching ability? ...

Does anyone have any experience with Blobstreaming.org?

The practical implications of serving images from a database are easy to understand. On one hand it's consistent (since everything else is in the DB) and means that when you scale to multiple servers the files don't need replication. However it puts a huge burden on the database (time required to respond) and on the intermediat networ...

cp1250_general_ci to UTF-8 help

Hello, I'm fetching data from external database (I cannot edit it so don't suggest that please) which has internal encoding set to cp1250_general_ci. I need to display that data as UTF-8 but I cannot get it to work. I'm using this to fetch the data: $dsn = 'mysql:dbname=eklient;host=127.0.0.1'; $user = 'root'; $password = 'root'...

Mysql subquery with conditional left outer join

Hello, Trying to use parameter from external query in subquery FROM clause. tbl1: | id | val1 | str1 | | 1 | 12 | sbc | | 2 | 22 | sds | tbl2: | id | val1 | str1 | | 1 | 1 | cp | Trying to write the following query: select * from tbl1 t, (select * from tbl2 where t.id = tbl2.id and tbl2.val1 = 1) tb12; Expected ...

Automatically trimming length of string submitted to MySQL

When I submit a form field to a mySQL database is there a way to set the database to automatically discard any data in excess of the data field length? I know I can do it programatically, but can the database be set to discard the excess without throwning an error? EDIT for clarity heres my insert statement <cfquery datasource='#argu...

Joining Query problem

I want to join 2 tabls with id. I wrote following query but i am getting an error. I want to select all columns simultaneously in mysql. select t1.* t2.* table1t1 JOIN table2t2 ON t1.id = t2.postads_id where ads_id=1277719543 AND email='[email protected]'; ERROR: #1064 - You have an error in your SQL syntax; che...

mysql function return list of data

Hello, I would like to write a mysql function that takes an integer as input and that function execute a select statements "select id from table_name" then i want that function return the result of select statements. then in query i want to do smthing like: select id,name from table_name where id in (call function here that returns ...

mysql UPDATE statement - overhead for same values?

i have a large MYSQL database with hundreds of thousands of records. i want to update a field in a large number of them, but I am unaware if that field has been updated yet or not. if i call an update statement that sets authortype=10 and authortype is already 10 will this be faster than doing a separate query to only select those that ...