Tag Info

New answers tagged

0

Your options are: Use PDO, which properly supports binary parameters; or Use pg_escape_bytea with string substitution into the query text. See http://stackoverflow.com/q/17121791/398670 .


3

You need a compound unique index. Suppose your table is called photos. You can do this: CREATE TABLE photos_new LIKE photos; ALTER TABLE photos_new ADD UNIQUE INDEX pid_tid_index (pid,tid); INSERT IGNORE INTO photos_new SELECT * FROM photos; ALTER TABLE photos RENAME photos_old; ALTER TABLE photos_new RENAME photos; If it works out, then run DROP TABLE ...


0

Can you check if your query_cache_type is set to 1 ? 0 or OFF - Do not cache results in or retrieve results from the query cache. Note that this does not deallocate the query cache buffer. To do that, you should set query_cache_size to 0. 1 or ON - Cache all cacheable query results except for those that begin with SELECT SQL_NO_CACHE. 2 or DEMAND - ...


2

You can use LAST_INSERT_ID() to get the inserted id for example if you insert a row in your photos table and you need that auto incremented id for the detail table you can do so INSERT INTO photos (purl, uid,`time`,title) VALUES ( 'test',1,1111,'test'); INSERT INTO photodetail (pid, ptext, location) VALUES (LAST_INSERT_ID(), 'test', 'test'); Fiddle Demo



Top 50 recent answers are included