I want to make a little php poll. The script should ask the users a question they can only answer by numbers from 0-999. After pressing the submit button the data should be stored into mysql. So I just want to know how much users choosed the same number (in percent). It's a simple poll but I don't want any output to be shown.
How do we monitor that the connectivity between the rails app and the database is established. will rails try to re-connect the connection with mysql if it closes?
I have two tables, with the same structure, for example: table "first' with columns 'a','b','c' and table 'second' with the same columns. How to find difference betweet those two tables?
Of course, I can make some script on python, that will make set(a)-set(b), but I think there is some way to do it in mysql.
Hello,
Anybody can help me with this mysql query:
delete from generic__campaings_included where dealer_id not in ('2,3,4') and campaing_id = '1'
When i execute this query i didnt get normal result. Exceot 2 (dealer_id) all rows deleted.
How can i use "not in" with "and" operator?
PS. Sorry for my english)
I'm in the process of building a site with CodeIgniter. This is the 1st site that I've built myself that interacts with a database. I'm using MySQL for this project. How can I tell if data needs to be escaped before saving it to the database?
I have a table called 'highscores' that looks like this.
id udid name score
1 1111 Mike 200
2 3333 Joe 300
3 4444 Billy 50
4 0000 Loser 10
5 DDDD Face 400
Given a specific udid, I want to return the rank of that row by their score value.
i.e. if udid given = 0000, I should return 5.
Any idea how to write this query for a MySQL database?
I have a mysql database with 60 tables most of the tables have primary keys (expect pivot tables) all these primary keys had the attribute AUTO INCREMENT
Then over night some how all the primary keys had that attribute removed, and the default value set to 0.
I have no idea how this may have been caused. Any suggestions?
Is it possible to restore a MySQL database from the physical database files. I have a directory that has the following file types:
client.frm
client.MYD
client.MYI
but for about 20 more tables.
I usually use mysqldump or a similar tool to get everything in 1 SQL file so what is the way to deal with these types of files?
Is there any way, i can use 'Load data infile' in a stored procedure.
I am using mysql.
LOAD DATA LOCAL INFILE 'C:\\MyData.txt' INTO TABLE
tempprod fields terminated by ',' lines terminated by '\r\n';
SELECT * FROM product p;
I have two tables with the same structure:
id name
1 Merry
2 Mike
and
id name
1 Mike
2 Alis
I need to join second table to first with keeping unique names, so that result is:
id name
1 Merry
2 Mike
3 Alis
Is it possible to do this with MySQL query, without using php script?
I have a bunch of records with dates formatted as a string such as '04/17/2009'
I want to convert them to a mysql datetime field
I plan to use a foreach loop to read the old date value and insert the newly formatted value into a new field in each record
what would be the best way to convert that string...I thought php might have a way to do it automatically?
thanks
Hi, I'm new to NHibernate. Actually I'm trying to save the values ffrom two text boxes into MySql Database in asp.Net page. I that I got
"Resource not found: WebApplication1.Sample.hbm.xml" error. But I can't fix this error. Can anyone help me to fix this one?
Seems like max table comments length in mysql is only 60 characters.
I'm developing an aplicacion in php symfony, which automatically generates sql ddl sentences, and in many cases those comments are far beyond 60 characters.
Is there some way to increase that limit?
thanks a lot
User writes a series of tags (, separated) and posts the form.
I build an array containing the tags and delete dupes with array_unique() php function.
I'm thinking of doing:
go through the array with foreach($newarray as $item) { ... }
check each $item for existence in the tags mySQL table
if item does not exists, insert into tags table
Is there a FASTER or MORE OPTIMUM way for doing this?
Hi All,
I would like to store "2010-03-26 10:13:04 Etc/GMT" value in column of type datetime.
when i try to insert it i got exception
SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10:13:04 Etc/GMT', at line 1
how to insert data time with time zone.
Thanks in advance.
please help me its urgent.
I have a MySQL database with a field Name which contains full names. To select all people with last names starting with a particular letter, let's say A for this example, I use the following query: SELECT * FROM db WHERE Name LIKE '% A%'. However, this also selects users who have a middle name starting with A. Is there anyway to alter this query so that only a last name starting in A will be selected?
For some reason, the developers at a new company I'm working for decided to name their columns "ignore" and "exists". Now when I run MySQL queries with those words in the where clause, I get a syntax error; however, I can't seem to figure out how to reference those columns without running into an error. I tried setting them as strings, but that doesn't make any sense.
Help?
Also, is there a term for this kind of mismatch?
I am looking for few global variable in mysql which are equivalent of sql server.
I want the whole list
eg.
Sql Server Equivalent
@@error ---
@@Identity ---
etc.
Basically right now I want to know what are the equivalent variable of @@error and @@identity.
But it will be helpfull if u could provide some other variable also
This one is really puzzling. I can't seem to be able to run any prepared statement on MySql 5.1. Any simple select I'm writing runs fine but when I'm trying to run it from a prepared statement I'm getting Query returned no result set. What Am I doing wrong?
Exmaple:
prepare s from 'select * from t';
execute s;
Thanks!
Assume I have the following tables:
TABLE: foo
- foo_id (PK)
TABLE: tag
- tag_id (PK)
- name
TABLE: foo_tag
- foo_tag_id (PK)
- foo_id (FK)
- tag_id (FK)
How do I query this so that I get a result like this:
==========================
| foo_id | tags |
==========================
| 1 | foo, bar |
| 2 | foo |
| 3 | bar |
--------------------------
Basically, I need all of foo's tags in one column, comma separated. Possible in MySQL?
Hi, I'm new to SQL Server, and used mysql for a while now...
SELECT A.acol, IF(A.acol<0,"Neg","Pos") as Column2 From Table
I want to do something like that on SQL Server, but there doesn't exist the IF instruction.
How do I replace that if, in a SQL Server 2008 Query?
I was wondering if you where to have an article or articles with huge amounts of text, what would be better when creating the database structure for the articles text? And why?
What will be the advantages or disadvantages if any?.
I was thinking of using one of the data types below to hold the articles text for the MySQL database.
VARCHAR
TEXT
MEDIUMTEXT
LONGTEXT
Hi i am writing a converter from Oracle to mysql
In Oracle the images are stored in db.
I want to read the content of the image and save to file system
I suppose that i have to read the blob entry and using php file commands create the file (am i right)
What about image type. Should i save as jpg (what if the store image is not jpg)
Any suggestion are welcome