mysql

SQL-query to find articles with at least one of the listed tags

I have 3 tables: articles, tags and article_tag (the one which connects them). I'd like to find all articles that have some (or all) of the tags listed in the query and order them by the number of matched tags. Is it possible? Example in english: Query: Find me all articles that have at least one of these tags "jazz, bass guitar, soul...

What is a proper naming convention for MySQL FKs?

Being that they must be unique, what should I name FK's in a MySQL DB? ...

(PHP) When using a SHA256 hash, how long is the hash? (ie, how long should my mysql VARCHAR be?)

I'm going to run SHA256 on a password + salt, but I don't know how long to make my VARCHAR when setting up the mysql database. What is a good length? ...

PHP5.3 is not working with MySQL5.1 IIS7 Times out

I have set up PHP5.3, MySQL5.1, and IIS7 on Window 7 but php doesn't want to work with MySQL. I'm assuming it is a configuration error or an incomplete install on my part. MySQL5.1 is working PHP5.3 is working, phpinfo() shows info and that i have enabled MySQL IIS is setup and using fastCgiModule to run PHP IIS registers php.ini...

How to get data from 2 mysql tables

what is the syntax if I want to utilize 2 or more tables for my mysql query. Example, I'm going to fetch the idnumber from the 1st table and the religion on the 2nd table. And the query will return the combined version of those 2 tables showing only the religion and idnumber. The code might look something like this , but it doesn't wor...

Javamelody with Tomcat and MySql

I have setup a web application in Tomcat with Javamelody and MySql. I am able to see the JDBC connection details under system info so I know that Javamelody is able to connect to the database. I have executed select/update statements from my application but nothing is ever shown on the monitoring page under statistics sql. I have execute...

In MySQL queries, why use join instead of where?

It seems like to combine two or more tables, we can either use join or where. What are the advantages of one over the other? ...

Large Forms = Large PHP/mySql Query Strings... Is There a Good Solution?

I've got a CMS I'm building where I've got a rather large form full of data to add to my database. This is where I collect my variables.... $orgName = $_POST['orgName']; $impact = $_POST['impact']; $headline = $_POST['headline']; $content = $_POST['content']; $subContent = $_POST['subContent']; $meterText = $_POST['meterText']; $mont...

In Kohana 3, how do you figure out errors made during a query?

I'm using Kohana 3. I'm writing an update query, and it is working for everything except this one section. If I do a var_dump() on the results of $db->execute() I get either a 1 or 0 to say it failed or not. It is failing in this example (returning 0). How can I figure out what error is happening? It justs seems to be silenty failing ...

How to get an ordered list of rows within 0 value whit sql?

For example: SELECT * FROM atable ORDER BY num; 'atable' is: num name 1 a 3 y 0 cc 2 fs The result is: num name 1 a 2 fs 3 y 0 cc But I want it to be: num name 0 cc 1 a 2 fs 3 y ...

add days and hours in date/time field and get the updated date/time in php using mysql

I would like to provide the ability for users to submit a datetime value, along with values representing additional days/hours, and then store the datetime that results from adding the two in a mysql database. ...

Using MySql MySQLMembershipProvider - autogenerateschema="true" not working?

I'm trying to use the MySQLRoleProvider(MySql.Web, Version=6.2.2.0) with Visual Web Developer 2008. When trying to add a role I get an exception "Table 'test.my_aspnet_applications' doesn't exist" if (!Roles.RoleExists("TestRole")) { Roles.CreateRole("TestRole"); } Can someone tell me where I went wrong. Or tell me how to generate ...

Result consisted of more than one row Error 1172 mysql

Hello im having a hard time with this stored procedure. im getting the error: Result consisted of more than one row. here is my stored procedure: DELIMITER $$ DROP PROCEDURE IF EXISTS `dss`.`COSTRET` $$ CREATE DEFINER=`dwadmin`@`192.168.%.%` PROCEDURE `COSTRET`( TDATE DATE) BEGIN DECLARE done INT DEFAULT 0; DECLARE ls_id VARC...

MySQL Result consisted of more than one row

Hi there im just new here and i have a question regarding my error on mysql it said Result consisted of more than one row. I have no idea how to solve this your help is much appreciated! DELIMITER $$ DROP PROCEDURE IF EXISTS `dss`.`COSTRET` $$ CREATE DEFINER=`dwadmin`@`192.168.%.%` PROCEDURE `COSTRET`( TDATE DATE) BEGIN DECLAR...

Update an external MYSQL database every..2mines from an internal one.

How can I update a MYSQL database ever few minutes to an external database? I was thinking of doing a database dump every 2 minutes to the other server, then the other server could have a cron job to apply the new data to it's database, good idea? The reason I want to do this is because I have 2 servers, one which doesn't pretty much a...

PHP MYSQL: Insert "+" sign in MYSQL using PHP

when i insert let say: mysql_query("insert into table1 (title) values (\"date + book\")"); the "+" sign is converted to a space. so it became "date   book" not "date + book" what should i do to insert it as it is. but if i directly query this to MYSQL it accept it as it is.. please clear my confusion.. thanks "UPDATE campus_bookinf...

I am displaying a list of categories in ASC order."OTHERS" is also one of the category. I need to display all categories in ASC ORDER and "OTHERS" in last .

I am displaying a list of categories in ASC order."OTHERS" is also one of the category. I need to display all categories in ASC ORDER and "OTHERS" in last . This is done by using PHP and MYSQL. TABLE STRUCTURE tale name: categories id categoryname 1 APPLE 2 BANANA 3 Strawberry 4 Other 5 grape For example: the above is the...

unmanaged VPS account; Beginners questions

I have a classified website which uses MySQL, PHP, Solr (java) etc etc... I wonder where I should start after purchasing a VPS package from my provider. There are first of all several packages, I am going with Linux because as far as I know it is the most stable system. But I have never used Linux before! What is Ubuntu, and which ver...

Getting DataSource resource in a Java web app

I have the following resource tag in my context.xml file: <?xml version="1.0" encoding="UTF-8"?> <Context antiJARLocking="true" path="/myApp"> <Resource name="jdbc/myDS" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="1000" username="user" password="passwd" driverClassName="com.mysql.jdb...

MYSQL mass deletion FROM 80 tables

Hi, I have 50GB mysql data base (80 tables) that i need to delete some contents from it. I have a reference table that contains list if product ids that needs to be deleted from the the other tables. now, the other tables can be 2 GB each, contains the items that needs to be deleted. my question is: since it is not a small database, ...