mysql

In PHP + MySQL, How do I join many tables with conditions

Hi, I'm trying to get the users full activity throughout the website. I need to Join many tables throughout the database, with that condition that it is one user. What I currently have written is: SELECT * FROM comments AS c JOIN rphotos AS r ON c.userID = r.userID AND c.userID = '$defineUserID'; But What it is returning is ever...

Time calculations with MySQL TIMEDIFF

Hi there, I have the following table: mysql> SELECT id,start1,stop1,start2,stop2 FROM times; +----+---------------------+---------------------+---------------------+---------------------+ | id | start1 | stop1 | start2 | stop2 | +----+---------------------+---------------------+----...

Successful SQL Injection despite PHP Magic Quotes

I have always read that Magic Quotes do not stop SQL Injections at all but I am not able to understand why not! As an example, let's say we have the following query: SELECT * FROM tablename WHERE email='$x'; Now, if the user input makes $x=' OR 1=1 --, the query would be: SELECT * FROM tablename WHERE email='\' OR 1=1 --'; The ...

generate unix timestamp from last time

hi guys, suppose i have one column in mysql database which is stated last time one equipment is up in h:i:s format (ex: 00:05:11) or 1d21h, means that the equipment is on since 5 min before, what is the best method i can convert this to unix timestamp, say if using php script how? or direct convert last unix timestamp using mysql functi...

Why mysql is not storing data after "#" character?

Hey Friends, I have made one form in which there is rich text editor. and i m trying to store the data to database. now i have mainly two problem.. 1) As soon as the string which contents "#"(basically when i try to change the color of the font)     character, then it does not store characters after "#". and it also not store "#" char...

What's the different between these 2 mysql queries? one using left join

Hi, I see people using LEFT JOIN in their mysql queries to fetch data from two tables. But I normally do it without left join. Is there any differences besides the syntax, e.g. performance? Here's my normal query style: SELECT * FROM table1 as tbl1, table2 as tbl2 WHERE tbl1.id=tbl2.table_id as compared to SELECT * FROM table1 as t...

Find the closest locations to a given address

I have built an application in CakePHP that lists businesses. There are about 2000 entries, and the latitude and longitude coordinates for each business is in the DB. I now am trying to tackle the search function. There will be an input box where the user can put a street address, city, or zipcode, and then I would like it to return t...

insert a date in mysql database

I use a jquery datepicker then i read it in my servlet like that: String dateimput=request.getParameter("datepicker");//1 then parse it like that: System.out.println("datepicker:" +dateimput); DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); java.util.Date dt = null; try { dt = df.parse(datei...

ConnectJDBCDataStoreHelper Jar File

Hi... I'm trying to create mysql datasource in websphere. I have setup the data source and test the data source from the admin console. I used ConnectJDBCDataStoreHelper as datasource helper. Now, I'm trying to access the datasource from desktop application using Hibernate. I've set the JNDI URL, ContextFactory and etc. And I have refe...

Subsonic 3.0 Query limit with MySQL c#.net LinQ

Hello, a quick question which may or may not be easily answered. Currently, in order to return a limited result set of data to my calling reference using SubSonic I use a similar function as below: _DataSet = from CatSet in t2_aspnet_shopping_item_category.All() join CatProdAssignedLink in t2_aspnet_shopping_li...

Ordering a MySQL query with joins and groups

I have this MySql query: SELECT * FROM Customer c JOIN eHRDemographic ehD ON ehD.CxID = c.CustomerID JOIN CustPrimaryWeight cpW ON cpW.CxID = c.CustomerID WHERE c.CustomerID =22703 GROUP BY c.CustomerID ORDER BY cpW.CustPrimaryWeightID DESC This doesn't really work correctly as the CustPrimaryWeight table has multiple entries a...

Improve my Zend Stored Procedure calling code.

Hi, I'm wondering how i can improve my Zend code that calls a stored procedure. At the moment i'm using a MySQL DB, and the action function in my controller below works, but it seems nasty. public function callSPAction() { $param = $this->_request->getParam('param', 0); $bootstrap = $this->getInvokeArg('bootstrap'); $confi...

Is it wise to use temporary tables?

Hi guys, We have a mySQL database table for products. We are utilizing a cache layer to reduce database load, but we think that it's a good idea to minimize the actual data needed to be stored in the cache layer to speed up the application further. All the products in the database, that is visible to visitors have a price attached to t...

MYSQL QUERY to find out the every second saturday of the month of the year

Hi Everyone, I need help to write one query Description: I need to find out the every second Saturday of the each month of the year. Thanks in advanced, RPL ...

PHP/MySQL - Working with two databases, one shared and one local to an instance of application

The situation: Using a off-the-shelf PHP application, I have to add in a new module for extra functionality. Today, it is made known that eventually four different instances of the application are to be deployed, but the data from the new functionality is to be shared among those 4 instances. Each instance should still have their own dat...

UDF function with library dependencies on MySQL 5.1

I'm having a problem with a MySQL UDF function (mychem.sourceforge.net) that's dependent on a large library (openbabel.org) which is in turn plugin based. The problem is that the format plugins to openbabel doesn't seem to load in MySQL 5.1 and I suspect it might be due to the plugin_dir setting. I have set plugin_dir to /usr/lib/ which ...

How to do authentication using SOAP ?

How do i authenicate users with SOAP ? Will i have the user require to send his username/pass with every SOAP request and i authenticate him against the database ? Doesn't that seem to cause unnecessary queries ? ...

What is the best FREE solution to implement one ETL project in MySql

Hi, What is the best FREE solution to implement one ETL project in MySql? I need to extract for analisys big amount of data, and put the results in other tables. Regards, Pedro ...

mysql complex key or + auto increment key (guid)

Hi, I have not very big db. I am using auto increment primary keys and in my case there is no problem with that. GUID is not necessary. I have a table containing this fields: from_destination to_testination shipper quantity Where the fields 1,2,3 needs to be unique. Also I have second table that for the fields 1,2,3 stores bought q...

Fill in missing values in a SELECT statement

I have a table with two columns, customer id and order. Let's say I have in total order IDs 1,2,3,4 All the customer can have all the four orders, like below: 1234 1 1234 2 1234 3 1234 4 3245 3 3245 4 5436 2 5436 4 You can see above that 3245 customer doesn't have order id 1 or 2. How could I print in ...