mysql

send database info to email

Hi guy, I was wondering if sanyone could help me with the following: I have some info inserted into mysql database on a couple of pages. After this is done I retrieve these info (in a new page) from the database and want to send them via email to various emails including one from the info from database. I have built the email() functio...

Mysql query timeout

Hi, I'm trying to execute a select using C#. The problem is that, despite the fact that I modified the timeout period, it thrown a timeout exception. It is rising the exception after 30 seconds, that is the default value. using (MySqlConnection conn = new MySqlConnection(connStr)) { int x = conn.ConnectionTimeout; conn.Open(); ...

PDO: MySQL server has gone away

I have a script that does a lot of legwork nightly. It uses a PDO prepared statement that executes in a loop. The first few are running fine, but then I get to a point where they all fail with the error: "MySQL server has gone away". We run MySQL 5.0.77. PHP Version 5.2.12 The rest of the site runs fine. ...

SELECT Statement Performance using * versus a List of Field Names

Possible Duplicate: Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc. In some code I'm reading, all SELECT statements are using a list of field names where all fields in the table are being selected. For example, with a table called Book and fields Author, PublishDate, Pages and Price, the select statem...

Query works fine in phpmyadmin returns 0 rows when ran from php

I'm really stumped by this. Here is the php: Update: I have escaped the inputs (before I did this a different way, but didn't know about mysql_real_escape_string). Also, I replace the double quotes with single quotes, yet the same problem is happening. Below is the updated code: $request = mysql_real_escape_string($_POST['id']); $c...

Select only newest records from table and make this FAST, how?

Good day, I have a question I'm struggling with a lot, hope somebody already found a clever solution to this (I use MySQL). I have table like this: Table `log` ---------- id inserted message user_id My goal is to select last inserted record for user and make this fast. Log table is huge (around 900k records), so my first approach was...

Sort mysql table based on number of rows in another table

Hi, I'm trying to sort a user table based on how many comments they have linked to them in a secondary comment-table, I figured a sub-select will be the best tool but I can't get the syntax correct. Users table testdata: id | user_id 1 | 1000 2 | 1001 3 | 1002 Comment table testdata id | link_id 1 | 1002 2 | 1000 3 | 1002 4 |...

Is something wrong with this MySQL query?

Hey guys, I'm trying to update a site that was coded horribly, and I think there is an error in this multiple IF statement. I've been Googling for a while and can't find any example of multiple IFs in a MySQL UPDATE query. The idea is, we want to update a certain column of the row based on a different column of the row. Here's the que...

Silverlight 3 and RIA Services and MySQL and Connector 6.22

I building a sl + ria application. I can add a model on asp.net project but when I add a dataservices class the tables from model(EF) does not show. ...

cities and distance by latitute-longitude

I have a table with: city latitude longitude And I need a sql query to know all cities are 100 miles from new york. Could anyone help me before I go crazy ? ...

Help with a transaction within a stored procedure

I have 2 very simple update statements that I need to use inside of a stored procedure. I want to use a transaction to rollback if either one of these updates should fail. Could someone please give me a sample to go by or point me in the right direction? I cannot seem to find what I need. I have no code at this point with exception of th...

Compiling Mysqldb for jython 2.5 on Solaris

I have used python2.6 + MySQL on Windows and there are binaries available. I wanted to get the whole thing working on Solaris Hence got the Mysql-Python package from here I had to get the setuptools installed which is done. Exploded the MySQL-python-1.2.3c1 When I this /jython2.5.1/jython setup.py build Error - `File "/opt/somepat...

Is there a "Force Index" equivalent in Vertica?

Is there a "Force Index" from MySQL equivalent in Vertica DB? ...

Fulltext search with rich media files.

Hi all, What's the best way to perform fulltext searches across rich media files? I'm trying to implement a system where the user could upload random files (.doc, .pdf, .jpg, ...) and down the line, he would be able to search for them based on the file contents or metadata. I would appreciate some ideas on how to build this. PS - I st...

How to return row of sum()s

I now find my original table structure was not good, so want to change it. But I am having a hard time designing queries to obtain totals in rows with the new structure. current structure: +----------+-------+-------+-------+-------+ | state | shop | item0 | item1 | item2 | +----------+-------+-------+-------+-------+ | 5 | ...

Would it be better to have the info in both tables? Or create a third table?

I have one table GAMES and another PLAYERS. Currently each "game" has a column for players_in_game but I have nothing reciprocating in the PLAYERS table. Since this column is an array (Comma separated list of the player's ID #s) I'm thinking that it would probably be better to have each player's record also contain a list of the games th...

latitude/longitude find nearest latitude/longitude - complex sql or complex calculation!

this is little hard one. i have latitude and longitude and i want to pull the record from the database, which has nearest latitude and longitude by the distance, if that distance gets longer then specified one, then don't retrieve it. Table structure: id latitude longitude place name city country state zip sealevel ...

Using Mysql blocking API with Boost::asio

I am building a aync single threaded server that receives data from clients. It processes the data and then saves it to the MySQL Database. The problem is that, MySQL C API does not support non-blocking calls and asio mainly does not like blocking calls. So I am thinking something like Python Twisted's deferToThread() like semantics. I...

mysql - How can I find common values in one table column based on another column using AND?

I have a cross reference table and need to find common values of one ID where the second ID has multiple values given in the query. This is easy to do with an "OR" but I can't for the life of me figure out how to do it with an "AND". I'm sure there is an obvious solution that has been staring at me for these many hours but I can't find...

UseQueryResult is not a member of mysqlpp

That's the error I get when I run this code : if(mysqlpp::UseQueryResult res = conn.query(sql).use()) Whats more interesting is that the next line doesn't have any problems while(mysqlpp::Row row = res.fetch_row()) Really driving me crazy. I've even manually included result.h I tried all combos of these include result.h, mysql++...