mysql

size of ENUM columns in SQL?

How do databases (mySQL if a particular example is important) determine the size of the column needed to store an ENUM? Is it something simple like a single byte for less than 256 enum options, etc.? ...

How to use an aliased column in a MySQL WHERE clause?

I have a MySQL query like this: SELECT *, SUM(...some SQL removed for brevety) AS Occurrences FROM some_table AS q WHERE criterion="value" GROUP BY q.P_id ORDER BY Occurrences DESC LIMIT 10; I want to restrict the results to rows where Occurrences>0. This seems very simple to me, but I can't seem to make it work. No matter what I tr...

SQL Server Full Text Search with Apostrophe

Any know how can I do a search in SQL with including apostrophes? For example: I want to search a username o'connel in the database with sql. ...

fine db comparer program for mysql

working with ms sql I have several tools I use to compare DB structure and data, like sql-compare, sql-delta, SqlClarity Effects, etc... is there some equivalent program for mysql??? I need a programa that can show me differences and, if possible, prepare the synchronize scripts... if it's free it would be better... ...

Trimming or converting a mysql date field with php

Hello, I am displaying the contents of a datetime field in mysql in a table with php, and want to show just the date. Is there a way to convert or do this, or must the actual string be editied or trimmed? ...

ssis variable syntax conflicts with mysql output variable

I've created an SSIS package that needs to execute a MySQL SPROC with an output parameter. The MySQL SPROC works fine from Query Browser. The problem is that the @ character is used to mark a SSIS variable and also is used as a MySQL sproc variable for output. The step does not work in SSIS. Does anyone know a fix? ...

Restoring MySQL database from physical files

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? ...

MySQL Insert Where query

What's wrong with this query: INSERT INTO Users( weight, desiredWeight ) VALUES ( 160, 145 ) WHERE id = 1; It works without the WHERE clause. I've seemed to have forgot my SQL.. ...

How do I protect my forum against spam?

I have a forum on a website I master, which gets a daily dose of pron spam. Currently I delete the spam and block the IP. But this does not work very well. The list of blocked IP's is growing quickly, but so is the number of spam posts in the forum. The forum is entirely my own code. It is built in PHP and MySQL. What are some concrete...

MySQL internationalization with DCM4CHEE

I'm attempting to internationalize dcm4chee (a Java based open source medical imaging storage with system) with MySQL, and have a number of questions. Here's what I know so far 1. I need to change the character set from latin1 to utf8 (to support all the international characters) in the MySQL 2. I'm pretty sure I want to set the collati...

(MySQL) OrderBy Field1=3, Field2

Hello I wish to order a table: Firstly by Field1=3 Then by Field2 DESC I know I can't write OrderBy Field1=3, Field2 DESC So how can I implement this?? TO CLARIFY: Let's say I have a table of books. I wish to list ALL the books in the table. I wish the books from 1990 to appear at the top, then the rest of the books in alphabetical...

Is jdbc by itself compatible with mysql.

I'd like to know if jdbc by itself is compatible with mysql or do I have to intsall something extra? I was told it is not compatible and that I'd have to use a different database. ...

What's the most efficient way to check the presence of a row in a table?

Say I want to check if a record in a MySQL table exists. I'd run a query, check the number of rows returned. If 0 rows do this, otherwise do that. SELECT * FROM table WHERE id=5 SELECT id FROM table WHERE id=5 Is there any difference at all between these two queries? Is effort spent in returning every column, or is effort spent in fil...

MySQL - PHP - Using while() display even with NULLS

I have a table and I am displaying its contents using PHP and a while(); I have about three fields in the table that are NULL but can be change, but I want them to still display all the results in my table. But, it only shows the records with data in EVERY field. Anyone how I can display it? I get a count of the table and it gives me 2,...

fetching database from MySQL to SQLite

Hello, i am trying to complete an iphone app. And for this i need to fetch a database from MySQL to SQLite. for this case i did use some code like bellow- MCPConnection *theConnec; MCPResult *theRes; //initialize connection string vars NSString *dbURL = @"XXXXXX"; NSString *userName = @"XXXXXX"; NSString *pass = @"XXXXXX"; //open conne...

php giving a blank page, no errors

Hello, I have the following part of an AJAX application, which gives no errors, but also nothing is displayed to the screen, so I am unsure of where the problem lies. Calling this page directly from a browser with ?cmd&id=1 should return, or even calling it without ?cmd should return the cmd error message. edit: added test cases: I do ...

Converting mysql to mysqli - how to get superglobal connection object?

I am trying to convert code from mysql to mysqli. The code uses a single mysql_connect in a file which is included by every other file. mysql_connect returns a MySQL link identifier that is a superglobal so you can rely on having a database connection available in any of your own functions. It looks like with mysqli_connect this is not...

navigation for limiting sql records

I want to write a page that will show all the records from a database, and have it limited using the SQL LIMIT syntax. My question is how would I use PHP to automatically generate the links? Would I have a variable that would automatically increase somehow, hardcode the links in etc, Is there a convention or best practise for this kind...

Best method for pre and post processing multilingual user input for a php/mysql CMS

Okay, there is a ton of stuff out there on sanitizing strings but very little, that I can find, on the best methods to prepare user input (like what I'm typing now) for inserting into a content management system then how to filter it coming out. I'm building two multilingual (Japanese, English + other Romance languages) CMSs and having ...

phpMyAdmin - Did the Config files change?

I have just installed phpMyAdmin on my new Fedora Core 10 dedicated server. I downloaded the phpMyAdmin-3.1.2-english.tar.gz. I extracted it and placed it in this folder /opt/phpMyAdmin-3.1.2-english and i created a symbolic link in the /var/www/html directory so that I can access it like this: http://www.mydomainname.com/webdb. When I...