mysql

Strange Mysql error 1111, supposedly worked before...

I am trying to troubleshoot a particular 'report' that gets generated on a PHP application running on a VOIP platform (billing related). The person that asked me to do this stated "it worked before" ;) MySQL Error thrown: 1111: Invalid use of group function Crazy thing is, it 'worked before' but stopped after awhile, they cannot place ...

conditional query mysql

hi, i have this mysql schema: comments: ----------------------------- |id|pageid|userid| members: ----------------------------- |username|userid| sometimes the userid from comments is blank, cause anon comment. how i can get the username from members if userid from comments isn't blank. i need to get something like t...

filemaker pro export and import to mysql via php

could anyone advise me direct me to a site that explains the best way to go about this I'm sure I could figure it out with allot of time invested but just looking for a jump start. I don't want to use the migration tool either as I just want to put fmp xml files on the server and it create new MySql databases based on the fmpxml results ...

mysql stored function parameter

Hi, I have just started to create a stored function this is my first time so I am having a few problems. Currently I call the fucntion using SELECT test(); (test is the function name for now). I want to send a number to the function (username ID) and have the username returned. I have this working by using SELECT test(1); 1 is the ID of...

PHP & MySQL - How to delete a users records from two tables.

Hello I'm new to PHP & MySQL and I was wondering how can I delete all of user_id 3 records from these two tables below using PHP & MySQL? My MySQL tables CREATE TABLE ls ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, skill VARCHAR(255) DEFAULT NULL, experience VARCHAR(22) DEFAULT NULL, self_grade VARCHAR(10) DEFAULT NULL, date_created DAT...

MySQL - MySQLi and the story of a mysterious error.

Hello, I have a system that runs on hundreds of websites and I am getting an error for the first time. I was hoping that someone could tell me what may cause this error so I can try to remove it. The issue comes when trying to add a page. INSERT INTO pages (parent, name, type, sort) VALUES ('0', 'test', 'text', '37.5'); This spits o...

What does the MySQL USING statement do in conjunction with DELETE?

What does the MySQL USING statement do and is there any docs on this? MySQL USING statement example DELETE FROM l, s USING l INNER JOIN s ON s.skill_id = l.id WHERE s.user_id = 3 ...

MySQL daily check and update

Hello to all . Is possible to create a routine or procedure that can automatic everyday check a date in a table. To be simpler : I want to check if the date on a user have permitions to enter a site and when the date pass want to make the user field activated false. routine daily check if (todaydate < dateclient) then clie...

Why do duplicate (and unwanted) inserts occur in mySQL?

The strangest thing has occurred with one of my apps (Flash/Coldfusion/mySQL). I use a simple INSERT statement to save member details into my table. The table has a Primary Key on the memberID. Recently, one of my entries was saved multiple times (not supposed to happen). The datetimestamp shows the save occurred at the identical time. T...

Combine many joins into one join?

There are two tables - incoming tours(id,name) and incoming_tours_cities(id_parrent, id_city) where id_parrent is id from first table. Here is the query i wrote SELECT t.cities FROM `incoming_tours` t JOIN `incoming_tours_cities` tc0 ON tc0.id_parrent = t.id AND tc0.id_city = '1' JOIN `incoming_tours_cities` tc1 ON tc1.id_parrent = t.i...

How can I check (My)SQL statements for syntactical correctness

Hi all, we're currently setting up out integration server and during that process we've set up pre-commit hooks on the SVN so that our developers can't check in files that are syntactically invalid (primarily PHP and XML). We also have a bunch of .sql files (for MySQL) which I'd like to lint as well. Unfortunately, Google didn't turn u...

MySql syntax question

Why does this work perfectly: SET @columnQuery = 'INSERT INTO ColumnNames SELECT ORDINAL_POSITION, COLUMN_NAME FROM information_schema.columns WHERE TABLE_NAME=''residents'' ORDER BY ORDINAL_POSITION;'; PREPARE STMT FROM @columnQuery; EXECUTE STMT; but this does not: DECLARE TableName VARCHAR(50); SET @TableName = 'residents'; SET ...

How to echo $row["Text'] to a TextField

Using PHP I am able to query MySQL database and see the results echo using: echo $row['Text']; I would like the information to load into TextField myAnswer instead. Can anyone help? Thanks ...

Could I same column to represent a foreign key to multiple tables?

I am trying to use the same column to represent a has foreign key to different columns. This is because there could be an arbitrary number of tables to be indexed using this column. Right now, my idea is to use a small varchar() field to represent which field they are indexing and then check for them my probably sub-querying for all that...

How can I send data from Yahoo quotes to MySQL with Perl?

After I download data from Yahoo and Google finance, how I do use a Perl script to send these to MySQL database automatically? ...

Is it wise decision to move from .NET to JEE or RoR?

To develop a new project we are thinking to train .NET people learning either JEE or Ruby on Rails. This decision is just because of open source and to avoid purchasing of operating system also Sql Server database. Currently there are no people who work on either JEE or RoR. All team members should learn from the scratch. If applicati...

How can I create a unique value in Perl for each record I fetch from MySQL?

How can I produce a unique value key to be paired with my _rec_key_ field name? I am producing a datafile. I was looking at using an MD5 value as my key or any other suggestions you have to making sure this is unique. I'm not familiar with how to extract this value. The format of the file should look something like this: __rec_key__^a...

Best way to manage Cron job for enrollment site

I manage an enrollment website which needs some new features for our agents. What we are trying to accomplish is the following: For every 3 members and agent enrolls, he receives a gift card (email sent to administrator to mail out) For 10 enrollments in a month, the agent receives his/her marketing materials free of charge for a year ...

Way to improve performance in MySQL on POINT(lat, long)

I have an application that needs to query a table with latitude and longitude coordinates, which are stored using MYSQL's POINT datatype. I have a stored function that finds nearby lats and longs within a given radius of a given GPS location. However, my table will contain hundreds of thousands of entries, so performance needs to be opt...

What file and directory permissions are required for MySQL LOAD DATA INFILE?

I have a script that is trying to load some data into MySQL with LOAD DATA INFILE. For some reason, it works if the file is in the /tmp directory, but not if the file is in another directory with identical permissions. I can't find any way to get MySQL to import data from outside the /tmp directory, or the database directory, but I can't...