mysql

MySQL query DATE comparison

I have a problem with my query. Its giving me the correct result for some cases and for some it does not, so if anyone could tell me what to change it'd be amazing cause I'm stuck with it for some time now. Here is my table data: Table reservation_logs: log_id int(15) auto_increment Primary Unique room_log int(10) dt_...

Are MySQL Foreign Key auto-generated names deterministic?

When constraints are created they are given names that look something like this 'FK5E6B788655A1514E'. I'm wondering if the name generation is deterministic or random. I noticed that two separate databases I was using, same schemas, ended up with the same FK names. Does it make sense when writing an upgrade script from one version of a ...

Creating ENUM variable type in MySQL

I am using an ENUM data type in MySQL and would like to reuse it, but not retype in the values. Is there an equivalent to the C, C++ way of defining types in MySQL? I would like to do the following: DEFINE ETYPE ENUM('a','b','c','d'); CREATE TABLE Table_1 (item1 ETYPE, item2 ETYPE); Is this possible? Thanks ...

dreamweaver and mysql help

I am new to dreamweaver cs4 and am trying to do some basic functionality. I have followed an online tutorial which showed me how to create a template.dwt file and include some editable regions in the file. Then to create HTML and PHP files based on the template which let me put data in the various editable regions. I want to take this...

TableAdapter Wizard in VS2008 does not like stored procedures with user variables

I can get the following statement to execute from the mysql command prompt but when I try to build a tableadapter with the visual studio 2008 dataset wizard I get an error. set @strsql = Concat('SELECT tblcustomers.CustomerId, tblcustomers.FirstName, tblcustomers.LastName, tblcustomers.Address, tblcustomers.City, tblcustomers.State, tbl...

MySQL two column timestamp default NOW value problem

I have table as shown below. In order to workaround one default now column restriction of MySQL I used the tip as shown here CREATE TABLE IF NOT EXISTS mytable ( id INT NOT NULL AUTO_INCREMENT , create_date TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00' , update_date TIMESTAMP NULL DEFAULT NOW() ON UPDATE NOW() , PRIMARY KEY (`p...

How do I rename an Index in MySQL

I would like to rename an index. I've looked at the alter table documentation, but I can't figure out the syntax to simply rename an index. When doing it through the MySQL GUI, it drops the index, and creates a new one. While this works, I would like to avoid rebuilding the entire index just to change the name of an index. [ADDITIONA...

How to password protect a directory but still give users access

I am creating a PHP script for my website that would allow my clients to login to their client account and view a list of files I've uploaded for them. Then they can download them without having to relogin or re enter a password. I want to keep it secure so anyone cant come in and download the files if they know the clients name. I've ...

Merging php arrays if "clientid" is identical?

Hi all, I have a query which gives back an array, I'd like to be able to merge the array values which have the same "clientid" Here's my query: SELECT * FROM #__db_clients_trip WHERE clientid IN (1999, 2984, 1681) AND companyid IN (1,2) Here's my array: stdClass Object ( [id] => 61 [trip_code] => EUR0600 [clientid] => 19...

I'm taking the contents of a 1.2mb webpage into a longtext field, server has gone away

I'm taking the contents of a 1.2mb webpage into a longtext field, server has gone away though everytime! ...

PHP will not delete from MySQL

For some reason, JavaScript/PHP wont delete my data from MySQL! Here is the rundown of the problem. I have an array that displays all my MySQL entries in a nice format, with a button to delete the entry for each one individually. It looks like this: <?php include("login.php"); //connection to the database $dbhandle ...

combine stored procedure in sql and my sql

am writing stored procedure in mysql 5.1 and call from c#.net ..and i want use that procedure in sql server..if its possible..please explain.. ...

How to work out a small Adobe AIR Application?

Hi, I would like to know how is it possible, or what knowledge do I need to acquire to create a small Adobe AIR application, probably like a employee directory search that will search and show a list of employee names, from a application based on php/mysql? Thanks. ...

Looking For PHP Book Examples?

I just bought a used book which is the PHP and MySQL Web Development (4th Edition) but the cd was not included in it I just want the chapters example code specifically the include_fns.php since they don't tell you how to code in this file. If any one knows where I can find the books source code examples please let me know. ...

[Lack of memory] Left join on the same table

Hi guys, i dont remember how to join a table to itself.. my table is: | id | proc | value | kind | | 1 | 1 | foo | a | | 2 | 1 | bar | b | | 3 | 2 | some | a | And i need to retrieve the value col where proc is $proc and kind is both 'a' and 'b'.. well, i need to do have that (looking for proc = 1): | v_a | ...

How to find count of transaction of type1 and type2 for each customer in mysql

I have a customer table: id name 1 customer1 2 customer2 3 customer3 and a transaction table: id customer amount type 1 1 10 type1 2 1 15 type1 3 1 15 type2 4 2 60 type2 5 3 23 type1 What I want my query to return is the follo...

Getting consistent menu tree data from menu tables in MySQL

Hi everybody, I have a tree / ancestor / query problem I'm not able to solve: I have a table holding menu data and a table containing all the ancestors of the menu: table menu table ancestors +-----+------------+--------+ +---------+--------------+-------+ | id | title | active | | menu_id | ancestor_id | l...

run sql query from a string using php

Possible Duplicate: execute sql query from sql file i have a file named file.sql which is exported from a database 'desktop'. i want import this old database to my new database 'laptop' using php scripts. i opened the file.sql using fopen and read all contents using fread and stored whole content to a string named $sqldata. how ...

MySQL query based replication

Hi, I wish to road-test a MySQL Cluster instance by passing it all query which are executed on InnoDB MySQL instance. I'm not too worried about data integrity on the Cluster at present, this study is focused on the stability and speed of the Cluster. I do not wish to use statement-based binary log replication as queries which are purely...

How do I query for records with multiple values for the last column in a compound GROUP BY clause?

Given data that looks similar to this: +---------+-----------+----------+ | country | city | district | +---------+-----------+----------+ | Japan | Tokyo | 1 | | Japan | Tokyo | 1 | | Japan | Tokyo | 2 | | China | Shanghai | A | | China | Shanghai | A | | China | Shangha...