mysql

breaking up strings with explode and foreach

I'm Trying to get a php string to break down into individual words, search for them in a database and then add the results into another database.. I currently have the string like this "SDGCC, ARISE, SDGFS" I want to search in the login tags table for tags LIKE these words i'm using this SELECT * FROM logintags WHERE tag LIKE '%st...

php + mysql_num_rows issue?

Hi, I have a simple sql statement and I would like to perform a different action depending on the number of rows returned. $result_lists = mysql_num_rows(mysql_query("SELECT * FROM db_table")); //To see the number returned print_r($result_lists); switch($result_lists) { case($result_lists == 0): //To prove...

MySQL datetime operation

How to get the datetime value several days/weeks/months/years later in MySQL? I just know the current datetime is NOW() . ...

unterminated string literal

i'm using jquery to output the results of a json string created by php from a database, the only problem is, that some of the data is on multiple lines... how would i get around this causing a unterminated string literal error in javascript? ...

How to insert time 2009-09-22 18:09:37.881 in MYSQL My column type is DateTime

How to insert time (2009-09-22 18:09:37.881) in mysql. Actually I can insert and retrieve the time 2009-09-22 18:09:37 in mysql but whenever I am trying to insert 2009-09-22 18:09:37.881 data did not get inserted in database. 2009-09-22 18:09:37.881 -------> YYYY-MM-DD HH:MI:Sec.Ms I have created a table using the below query Cre...

In MySQL: fetching rows distinct by year

I have a MySQL table similar to this: | id | name | create_date | --------------------------- | 1 | foo | 2003-03-11 | | 2 | goo | 2003-04-27 | | 3 | woo | 2004-10-07 | | 4 | too | 2004-12-01 | | 5 | hoo | 2005-04-20 | | 6 | koo | 2006-01-12 | | 7 | boo | 2006-04-17 | | 8 | moo | 2006-08-19 | I want to fetch al...

MySQL Question about limiting the result...

I want to know how to limit the MySQL result. I can use "select * from students" to show all the students, but it is too many. I can add where condition, but it still many students after I use where to filter the result. Is it possible to return first 100 students, and order by first name. And next time, I want the first 101-200 ... ... ...

MySQL Question about scheduling

I want to ask about scheduling, is there any MySQL command for scheduling. For example, I want to insert a data into the DB. Can I write a sql statement to hold it for some time, or maybe I insert this data in some scheduled time, for example, tomorrow 8:00 a.m. I know these can be done by programming, but I want to do it in SQL command...

mysql db as master, access mdb's updating from it - how?

I am helping a friend to streamline his little manufacturing business db. Currently, they have An address db bookkeeping db order mgmt db All the three are mdb files. They can't pay me really, so I am doing good will work. Thus, just doing the barely needed. It would be ideal to merge order mgmt and address, but that's maybe for l...

Composite Primary Key performance drawback in MySQL

We have a table with a composite Primary key consisting of three fields (and it is in MySQL 5.1). There are near 200 inserts and 200 selects per second on this table, and the size of the table is around 1 million rows and it is increasing. My question is, does the "Composite Primary Key" decrease the performance of the Inserts and Select...

decode mysqlbinlog in C#

Hi guys, MySQL saves all changes to the database in a binary file called binary log. MySQL provides a decoder called mysqlbinlog to decode these files. I thought if I wanted to parse this log file directly from an application then I need to find a way to decode it myself using C# for instance. I know if I had the privilege I could use ...

Speed up text comparisons (feature vectors) with spatial MySQL features

I have a function which takes two arrays containing the tokens/words of two texts and gives out the cosine similarity value which shows the relationship between both texts. The function takes an array $tokensA (0=>house, 1=>bike, 2=>man) and an array $tokensB (0=>bike, 1=>house, 2=>car) and calculates the similarity which is given back ...

Mysql field name within regular expression

I have the following table Table bots{ ip_address varchar(15), bot_name varchar(32) } Given that some bots have static ips and others won't, the table has entries such as 192.168.0 and 192.168.1.15 Now I have to see if a given ip belongs to a bot. I was thinking something along these lines SELECT bot_name FROM bots WHERE __i...

Javascript calling a java Servlet and return data help.

I don't have much experience with servlets and I've been going around in circles search for an answer to my issue. So it' time to get the experts answers! :) Overview: I need to get Javascript to call my servlet and return data to update the value on a form. I have a java servlet running in Glassfish V2.1 called DBGet, the purpose of ...

Mysql results problem

I'm making a website for my school and I need help with Mysql result. I need to know when is the gym available for use, ex : its busy from 2009-09-23 until 2009-09-30 and available all other dates, now I wrote a query but it aint workin. SELECT gym_name from gym, logs WHERE gym.gym_id = logs.logs_id AND (gym.date_busy_from < '2...

How do I utilise longitude/latitude values efficiently in Mysql ?

Thanks to Wikileaks, here in the UK we can now access our longitude and latitude co-ordinates for each post code wikileaks postcodes uk IMPORTANT. Do not use this data in public applications - There's concern that the data has been deliberately corrupted and you could be held as being in breach of copyright law. Try using data from an op...

Asp.net Page Counter : Store number in MySql Database

I've been searching the web for some good page hit counters. I'd like to create a page hit counter asp.net page that keeps its values stored in a MySql Database under a row called 'PageCounter'. Any ideas would be appreciated. ...

Whats the best way to INSERT (500-700) words into an MySQL database, for the purpose of a dictionary/histogram

I have to create a histogram/dictionary of all words found in parsing an html file. This includes a dictionary of all words found, and a histogram of their frequency. I cant think of how to do this with PHP/MySQL because there could be potentially 2000 words that would have to be INSERTED at once =/ Any ideas? ...

Best place to store alternative names?

if you haven't guessed by my other questions I'm building a soccer based apps and using data from different websites/feeds/api's but different websites carry team names either full names, abbreviated or slang names. examples would be- Manchester united- Man united- Man utd Tottenham Hotspurs- Spurs, Tottenham Hotspurs FC The main app...

Can a MySQL Enterprise Master replicate to a MySQL Community slave?

Might be a silly question, but I haven't been able to find an answer after a few days of searching. I have a single MySQL 5.0 Community server master (read/write) that replicates to four read-only slaves, also running 5.0 Community server. I'd like to upgrade the master and one slave to MySQL Enterprise Platinum to be able to use the...