mysql

Inserting a Date and Time value to a MySql from PHP

Hello i want to send to a MySQL data base a date and time in a format compatible with the mysql DateTime format, wich is: 0000-00-00 00:00:00 ... Im using this code who brings the date and time from a PHP command: $insert = "INSERT INTO sms (ref, texto, fecha) VALUES ('".$_POST['usuario']."', '".$_POST['sms']."', '".date(DATE_ATO...

Which mysql construct is faster?

SELECT ... WHERE COL IN(A,B) or SELECT ... WHERE (COL = A or COL = B) I'm trying to find out what are the differences between the two constructs? Would there be significant performance gains either way if utilized on resultsets that are nearing the 1 million mark? ...

Can I use a single MySQL query to select distinct rows and then non-distinct rows if a limit hasn't been reached?

I hope I'm explaining this properly, my knowledge of MySQL is quite limited. Let's say I have a table with rows that have a field called shape. I'd like to select a bunch of rows from a table, but return all of the rows with unique shape field values first. If I have less than a certain number of rows, let's say 7, then I'd like to f...

How do I show number of fetching of a data in a MySQL data base?

I would like to show to user how many time a data has been accessed. I am using MySQL and PHP. ...

Can't use where clause on correlated columns.

I want to add a where clause to make sure video_count is greater than zero. Only categories which are referenced once or more in video_category.video_id should be returned. Because video_count is not a field in any table I cannot do this. Here is the query. SELECT category . * , ( SELECT COUNT( * ) FROM video_category ...

ow do I store daily data to MySQL and show it in graph??

I would like to store daily data to Mysql and retrive it to show in a graph at the end of each month. for example: employee name is John: I would like to store his daily time sheets and work schedule to MySQL and then it should retrieve and displayed in graph format at end of each month. I know the graph part but I don't know how to s...

query structure - ignoring entries for the same event from multiple users?

One table in my MySQL database tracks game plays. It has the following structure: SCENARIO_VICTORIES [ID] [scenario_id] [game] [timestamp] [user_id] [winning_side] [play_date] ID is the autoincremented primary key. timestamp records the moment of submission for the record. winning_side has one of three possible values: 1, 2, or ...

Django tutorial says I haven't set DATABASE_ENGINE setting yet... but I have

I'm working through the Django tutorial and receiving the following error when I run the initial python manage.py syncdb: Traceback (most recent call last): File "manage.py", line 11, in <module> execute_manager(settings) File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362 in execute_manager utility...

combining "no results" second query with first query in MySQL

This is probably very easy, but I'm wanting to know the "best" or "standard" way of writing this query. I have two tables. One is a work schedule with a task name and start timestamp and end timestamp. This table is populated by a schedule manager ahead of time. UserId | task | startTime | endTime joe | dishes | 2...

PHPMyAdmin's 'Query took' time differs from MySQL Profiling information

Using the new MySQL Query Profiler in PHPMyAdmin version 2.11.5, I got following results (PNG-version) Status Time (initialization) 0.00004 Opening tables 0.000059 System lock 0.000003 Table lock 0.000006 init 0.000013 optimizing 0.000004 statistics 0.000015 preparin...

How to insert bulk data into mysql table from asp.net at once.

Hi, I have a requirement that I need to read an excel sheet using asp.net/C# and insert all the records into mysql table.The excel sheet consists of around 2000 rows and 50 columns. Currently,upon reading the excel records ,I am inserting the records one by one using a prepare statement into mysql table.But its taking around 70 secs to ...

MySQL Datefields: duplicate or calculate?

We are using a table with a structure imposed upon us more than 10 years ago. We are allowed to add columns, but urged not to change existing columns. Certain columns are meant to represent dates, but are put in different format. Amongst others: * CHAR(6): YYMMDD * CHAR(6): DDMMYY * CHAR(8): YYYYMMDD * CHAR(8): DDMMYYYY * DATE * ...

Does some Integer data types differnate with other Programming languages?

Do Integer data types allow spaces when it should be just numeric? Do other programming languages allow spaces in an Integer data type? For example, MySQL database storage does not allow spaces to be stored in an int data type. Do other languages allow it when storing in their own int type? ...

How much slower are prepared statements for single queries?

If prepared statements are used to only insert a single row. How much slower would it be compared to not using prepared statements? ...

How to restrict text search to a certain subset of the database ?

I have a large central database of around 1 million heavy records. In my app, for every user I would have a subset of rows from central table, which would be very small (probably 100 records each).When a particular user has logged in , I would want to search on this data set only. Example: Say I have a central database of all cars in t...

Unix timestamp VS datetime

I have a Mysql table, which has a column add_date. It tracks the date/time when the record was added to the database. Queries based on this table: Display when the record was added in the format: 2 hours ago, 4 weeks ago, 1 year ago etc Allow users to search records inserted in any day/month/year. So the user may be allowed to choose...

How to send the my sql result to controller in codeigniter as a variable

Hi In my mode I am selecting a field as $query1 = $this->db->query("SELECT dPassword FROM tbl_login WHERE dEmailID='[email protected]'"); How to return dpassword as a variable to my controller I tried this way return dpassword; ...

PHP,mySQL,ecommerce website

Can anybody suggest me a tutorial for developing an ecommerce website... ...

Excel string manipulation to check data consistency

Background information: - There are nearly 7000 individuals and there is data about their performances in one, two or three tests. Every individual has taken the 1st test (let's call it Test M). Some of those who have taken Test M have also taken Test I, and some of those who have taken Test I have also taken Test B. For the first two ...

Convert Mysql query in Postgresql query

Is there an utility to convert mysql query in postgresql query ? ...