mysql

mysql select a row only if a field at another row is equal to

I have these two tables: tAccounts id, name, server_id tFriends id_lo, id_hi Now, I'm trying this query: SELECT FR.id_lo AS id_friend FROM tFriends FR, tAccounts AC WHERE (FR.id_hi = 4 && AC.server_id != -1) ........ In order get the friends of a certain user, while making sure his friend's server_id is different than '-1' ! Any i...

Sourcing 'Fatal Error' resulting from MySQL ExecuteNonQuery?

Using Windows Server 2003, MySQL 5.1.23, MySQL .NET Connector 6.2.2 I am trying to use the MySQLBulkLoader class to read in a fixed width text file. An excerpt from that classes Load method is: string sql = BuildSqlCommand(); MySqlCommand cmd = new MySqlCommand(sql, Connection); cmd.CommandTimeout = 10 * 60;// Timeout; cmd.ExecuteNonQ...

PHP Maths on SQL Data

Hello all, im not sure if this is php or mysql maths question. Ive got a table full of data, and although i can echo the individual data to the screen or echo and individual piece of data using php. I've no idea how to perform maths on the data itself. For simplicity, say my table has 4 columns, an id column and three with my data i wa...

How to convert excel file into mysql database??

Hi guys my boss wants me to create a mysql database for an existing excel file. I was wondering if there are any ways to do convert or import excel file? I have searched google but didn't find anything useful. I appreciate for any reply....Thanks. ...

Linux app using C++ and visual studio

I want to write an app in visual studio that will work in linux. It's main function will be to monitor multiple linux systems and provide health and status to the GUI... I.e disk usage, bad drives, network throughput, mysql reads/inserts, ect... Can I cross compile with visual studio 2010? Should I even bother using visual studio? Or ...

Deleting with Max

This is based on my previous question. I have the following table Table1 JobPositionId | JobPositionName 1 | Sound 2 | Lights 3 | Sound 4 | Ground How can I delete row three (Name = sound, and max position) ...

Simultaneous mysql queries + PHP

I need retrieve data from 2 tables at the same time, the tables are not linked by foreigns keys or such. $query1 = "select idemployee from employee where address like 'Park Avenue, 23421'"; $query2 "select idcompany from company where bossName like 'Peter'"; How can I do this with a kinda thread in PHP?. I've heard that threads ar...

The used SELECT statements have a different number of columns

For examples I don't know how many rows in each table are and I try to do like this: SELECT * FROM members UNION SELECT * FROM inventory What can I put to the second SELECT instead of * to remove this error without adding NULL's? ...

MySQL UPDATE - Selective update

First up, apologies for the awful title I couldn't think of a better way to articulate my issue. (Feel free to suggest better altnernatives) Basically I have a table with a "count" column. I want to reset all counts to zero except for the 10 rows with the top values. I want them to be reset to 0. How do I achieve this without writing ...

mysql is outputting html-like text to the shell

I log into mysql like normal but whenever I enter a command such as describing a table: DESCRIBE status_types; I get text back that is markup-ish, like an HTML table instead of the usual text table. <TABLE BORDER=1><TR><TH>Field</TH><TH>Type</TH><TH>Null</TH><TH>Key</TH><TH>Default</TH><TH>Extra</TH></TR><TR><TD>status_type</TD>...

MySQL datatypes?

I'm designing a database in MySQL and PHP for a basic CMS. The CMS will have a front end which will allow sorting and searching. The backend will allow authorized users to upload files. I'm using PHPMyAdmin and I'd like help setting up my database. I am open to answers explaining various MySQL datatypes and what they are good for as w...

How can I make one table that "overrides" another?

Suppose I have two tables: CREATE TABLE A( id INT PRIMARY KEY, x INT, y INT ) CREATE TABLE B( id INT PRIMARY KEY, x INT, y INT, ) Table A contains data brought in from another vendor while table B is our data. For simplicity, I've made these tables be exactly the same in terms of schema, but table B would lik...

Update DataGrid bound to DataTable after DataTable is altered WPF

I have a combobox where the user can select a particular year (populated by the database) and view particular information for the year. That information is stored in a datatable which is bound to a datagrid. I want it to recreate the data grid when I change the year. _PropertyTenantData is a DataTable that has 14 columns Property Id, Pr...

MySQL/PHP - Time Passed

How can I calculate the amount of 5 minuet periods passed with a datetime type? is it possible? //Update AP (+1 points every 5 mins) // PLAN OF ACTION (for ap update)! // 1. check how long it has been since last update // 2. calculate how many 5 min periods has passed // 3. update $ap accordinly if ($last_ap_update != "000...

How Do i use JQuery to update the data

Ok so i am having a problem with figuring this problem out. I have a dynamic page that has records pulled out of a mysql database. The php code works great. The code is below $catagory = $_GET['type']; $query = "SELECT p.name, p.price, pc.quantity, p.image, p.descr FROM products ... where category_name = $catagory "; $result = mysql_qu...

What causes mysterious hanging threads in Colfusion -> mysql communication

One of the more interesting "features" in Coldfusion is how it handles external requests. The basic gist of it is that when a query is made to an external source through <cfquery> or or any other external request like that it passes the external request on to a specific driver and at that point CF itself is unable to suspend it. Even if...

Java - URLConnection for PHP $_GET Methods for MySQL

OK so what's the problem with this. I tried using MySQL JConnector for Java and people say not to because it can comprise your applet details so then I told them I'd use PHP $_GET method URLs using PHP scripts. They said it would be fine. However, I find two problems with that. 1.) They are slow. It takes at least 4-5 seconds for the UR...

Insert Paypal payment date in database with PHP

I'm not sure how to go about doing this.. I want to add a Paypal "buy now" button on my website and when a user pays I want to save the date they paid into the database using mysql. How would this be possible? ...

phpadmin mysql change 0 to 1 in a column

Great site, tons of help to me so far. I have a database with 10,000+ rows. There is a column ( tinyint(4) ) called ahtml. I need to change ~500 of the rows for that column from 0 to 1. I know there is a query I can run in phpadmin to do that instead of editing each row. I need to change ALL of the 0's to 1's in the ahtml column. G...

Concurrency Problem With MySql Last_Insert_Id()... (C#)

I'm not really sure why the following console application doesn't produce the expected behavior for last_insert_id(). I've read that last_insert_id() returns the last auto_incremented value for a particular connection, but in this code, the same result is returned for both connections. Can someone explain where I've gone wrong? st...