Tag Info

New answers tagged

1

You might need INFORMATION_SCHEMA.KEY_COLUMN_USAGE You would have to issue this query SELECT column_name FROM information_schema.key_column_usage WHERE table_schema='$db' AND table_name='$table' AND constraint_name='PRIMARY'; This will retrieve every column in the PRIMARY KEY. You could then make this query generate the ALTER TABLE clauses for you as ...


4

You need to keep the comparison column outside of your CASE statement. INNER JOIN Users u ON u.id = CASE WHEN c.sender = ? then c.reciever else c.sender END


1

I'd suggest, you store the 'chosen cards' in an separate assignment-table and group this assignment per user. For example your table 'cards': table: cards -------------- card_id | PK ... The following table stores the blurb for the given user: table: blurbs -------------------------------------------------------------- blurb_id | PK user_id | ...


0

Your code does not reveal any specific issue. I would say that the problem lies on the database server: your query may be blocked due to some on-going operation happening on the server, or the query is taking too much time for some other reasons. Without knowing which is the state of the server and which queries are running at the same time (or other ...


0

Add or edit the following line in your postgresql.conf : listen_addresses = '*' Add the following line as the first line of pg_hba.conf. It allows access to all databases for all users with an encrypted password: # TYPE DATABASE USER CIDR-ADDRESS METHOD host all all 0.0.0.0/0 md5


2

From my (rather limited) knowledge of php, I assume you want to combine the two queries into one: SELECT m.*, p.frequency FROM ( SELECT sid, COUNT(*) as frequency FROM plays WHERE time > NOW() - INTERVAL 3 DAY AND sid <> '' GROUP BY sid ORDER BY COUNT(*) DESC LIMIT 50 ) AS p JOIN music AS m ON m.sid = p.sid ...


1

As this is a m:n relationship you'd need an intermediate table that links authors to papers, e.g.: CREATE TABLE paper_author ( paper_id INT, author_id INT, PRIMARY KEY(paper_id, author_id) ); Then you can check for all authors of a paper with: SELECT paper.name, author_name FROM paper JOIN paper_author ON paper.id = paper_author.author_id ...


0

You need to run DESC state_master;. This will show you all the columns in that table. Fine the correct column name for the state name. Evidently, from the error, it is not State_name. Then, use that correct column name in the SQL Statement. If State_Name is the actual column name, then try lowercase on all column names $result = mysql_query("SELECT ...



Top 50 recent answers are included