mysql

Connection Time Out JDBC-MySQL

I have a Java application running Win 7 connecting to MySQL on the same host. Eclipse IDE shows the following error every time after 8-10mins. The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at com.mysql.jdbc.SQLError.createCommunicationsException...

SQL-injection - is this (oneliner) safe ?

PHP: $SQL = "SELECT goodies FROM stash WHERE secret='" . str_replace("'",'',$_POST['secret']) . "'"; Could an evil genius hacker inject SQL into my SELECT - How ? ...

MySQL not pulling all rows.

Hey guys, first time using stackoverflow. can you guys help me debug? Heres the problem, this query is selecting all of the rows from my database, its only outputting the first one twice for some reason. $top10_query = "SELECT * FROM kicks"; $result = mysqli_query($cxn, $top10_query) or die("Couldn't execute query."); $row = mys...

Good Tutorials On How To Build A Tree Menu using PHP & MySQL.

I was wondering if some one knew of any good tutorials on how to build a tree menu using PHP & MySQL? ...

How to configure Tomcat 6.0 with MySQL

Can one explain little more about how to configure Tomcat with MySQL? Where to place mysql-connector-java-5.1.13-bin in Tomcat directory? Should I place it under Tomcat 6.0\webapps\myapp\WEB-INF\lib? Do I need to confirgure context.xml or server.xml files? Should I write web.xml file and need to place under Tomcat 6.0\webapps\myapp\WEB...

Master and Slaves failover from Slave snapshot

Hello, I plan to use MySQL setup with one master server and several slave servers. I would perform regular consistent backup of the data EBS on one of the slave servers (I will always stop database before and restart it when it is finished). Slaves failover I one of the slave fails, I will start new instance and moun EBS based on the l...

noSQL for storing product information?

Hi everybody, We are about to solve a customer's need of a web based application that holds a big amount of products and their data - including prices, weights, physical volyme, and much more. Everything but the prices are data that is data that will be stored once, and then probably not changed. The prices on the other hand will be u...

Optimize query with two "in" clauses

I've trying to optimize a query on MySQL that takes around 15-20 seconds to run. My Data table has about 10M rows, and the query is trying to return 68,000 records which match 144 "run" fields and 35 "name" fields. Because the query is using two in clauses, my indexes don't seem to be terribly helpful. Here's the query: select * from...

How to count similar interests in MySQL

I have 2 tables, 'interests' and 'users_interests'. 'users_interests' just has userid and interestid fields. 'interests just has an id and a name. I simply need to find userid's who have more than 3 interest ID's in common. I have been told that a Self Join is involved, but I cannot seem to get this to work. Someone said something ...

Check if a list of other strings is %LIKE% another string

Is there a short way to check if a list of strings is %LIKE% a given string? For example: book animal a Would all satisfy this condition for "A Book about Animals"? I know that I could write out Title Like '%book%' AND '%animal%' LIKE Title, etc. but that seems unwieldy. I'm using this for an autocomplete, where I return results whe...

MySQL Updates are taking forever

Hey, im trying to wirte about 600000 Tokens into my MySQL Database Table. The Engine I'm using is InnoDB. The update process is taking forever :(. So my best guess is that I'm totally missing something in my code and that what I'm doing is just plain stupid. Perhaps someone has a spontaneous idea about what seems to eat my performance: ...

Get Data to PDF Form from MySql Database using PHP/JAVA

Hello All, I am working on project which need to get data from MySql database to PDF form. Can anyone please guide how can I solve this problem? I check internet for solution but I found I can create PDF form and get the data from DB to PDF form. My requirement are: I have PDF form on server I need to open that PDF form (using GUI) ...

How to retrieve subcategories of a given category

I've been looking around SO for a sec and been seeing questions about displaying categories and was wondering how would I display all my sub categories for my parent categories for example my link below? I'm using PHP & MySQL -Thanks in advance! Here is my link. http://www.example.com/categories/index.php?main_category=web-development...

Error connecting to MySQL Database using .NET.

When I try to connect to a MySQL Database from my .NET application i keep getting the error: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified I went to this URL and downloaded/installed the Windows, MSI Installer Connector-ODBC but I am still getting the error. Is there ...

mysqli object how do I get the fields

Hi. I tried this: $result = $conn->query("SELECT * FROM temp_users WHERE reg_code ='$passkey'"); This works: if($result->num_rows == 1){ values from print_r($result); mysqli_result Object ( [current_field] => 0 [field_count] => 11 [lengths] => [num_rows] => 1 [type] => 0 ) but $result->username where username is a field in the d...

MySQL implications of 'like' vs 'join' query

I've got two tables - Videos and Playlists Typically I would create the two respective tables and a multi-value table for the 1-Many relationship, such that : Videos = [pk, videoId, title, etc..] Playlists = [pk, title, etc..] Playlists_Videos = [VideosFK, PlaylistFK] Alternatively, I've been thinking about creating the two tables on...

Create field with default as epoch time

I need to create a timestamp field for a table who's rows need to expire after a certain amount of time. If I use the following: `timestamp` TIMESTAMP DEFAULT NOW(), It shows the time in a human readable format, it would be a lot easier if I could have it in epoch time so I can calculate with seconds. Is there a way I can create a fie...

which stack of web server SW for this particular deployment of an active mixed media social site

Hello moi capitans, I have been days reading about web server configuration and the more i read, the more confounded i become. I cant pull the trigger on any one deployment so i guess i need to adk for help before i move to the next step. For my first year of school i am taking my server and installing on campus to run a social site/ v...

Generating report from multiple mysql databases hosted on different servers

Hello, I have four different servers; parent.com, a.com, b.com and c.com. At the end of the day I have to pull data and generate report from a, b and c and show in parent. a, b and c databases are having same the structure, but as I mentioned, they're hosted on different IP/server. Can you please tell me what may be my approach? ...

MySQL query to return rows that are equal to or greater than a certain date, where the date is separated in year, month and day columns

A MySQL table EMPLOYEE has columns (beginyear, beginmonth, beginday, empid) all of type int. What's a correct query to return all rows that are equal to or greater than the date 2009/8/13? That's year, month, day. A query such as this is incorrect because it wouldn't return rows that contained dates such as 2009/9/1 (filtered out by b...