mysql

How would I calculate EXPECTED income if I have PAST income data in mySQL?

Ok, I'm just curious what the formula would be for calculating an expected income over the next X weeks/months/etc, if the only data I have in mySQL DB is all past transactions (dates of transactions, amounts, etc) I am thinking taking some averages and whatnot, but I can't think of a specific formula (there must be something along thos...

Cant Update row with Decimal DataType in Entity Frameworking using mySql

I have been working on this problem for too long. All of my select and insert commands work fine but when it comes to updating decimal columns i get errors. I am using the following software ASP.Net v4 MySQL Connector Net 6.3.3 MySql Server 5.0.51a Product Class public class Product() { public int ProductID {get;set;} publi...

Simple error checking with mysqli?

I'm using $mysqli->query all over the place without any sort of error checking or fall back if the query fails. What's the simplest/cleanest method I can use to catch these ? I'm thinking of a little function which can just display a friendly message and send me an email - I can write that but am not sure how to trigger/call it only w...

MySQL and foreign key conflicts when trying to INSERT.

I'm doing the Agile Yii book. Anyway, I'm trying to execute this command: INSERT INTO tbl_project_user_assignment (project_id, user_id) values ('1','1'), ('1','2'); And I get this error: ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`trackstar_dev`.`tbl_project_user_assignment`, CONSTRAINT `F...

What is better practise: storing images in MySQL or storing only image paths in MySQL?

Possible Duplicates: Saving images in database mysql Storing Images in DB - Yea or Nay? I just found out it's possible to store images in a mysql database. I just want to know if this is considered good or bad practice strictly in terms of performance. For a large scale site which would be better, storing the images in mysql...

MySQL: Error 1628: Comment for table 'customer' is too long (max = 60)

After fixing Error 1253 (http://stackoverflow.com/questions/3567808/mysql-unable-to-fulling-forward-engineering-sakila-sample-into-server), I have Error 1628. Executing SQL script in server ERROR: Error 1628: Comment for table 'customer' is too long (max = 60) Scripts: CREATE TABLE IF NOT EXISTS sakila.customer ( customer_id SMALLI...

Inserting Row in MySQL From Existing Row That Contains Quotes

Hi, Just wondering, to sanitize user input, I use mysql_real_escape_string() on data before it is inserted into a table. Therefore when a user enters something like this: Hi I'm just testing this It gets placed into the table just fine, exactly as above. Question is, if I were to pull that data and place it into a variable via PHP,...

Mysql, NHibernate and visual studio 2008 configuration

Hi, I am a beginer with visual studio 2008 (C#), mysql and NHibernate. I have problems with mysql connector as I don't know how to add reference to it. In my project I have: /lib/mysql-connector-net-6.1.4-src/ (downloaded from http://dev.mysql.com/downloads/mirror.php?id=387799#mirrors) Now I right click on my project -> addReferenc...

innodb and myisam in mysql database

what is the difference between innodb and myisam ? i see both of them as a type of engine in my mysql database. ...

When triggers are better in performance?

When a trigger is better in performance? For example. I've an insert and then an update wich counts the total rows from a table (where the insert was performed) and the save the value in another table. But i was thinking instead run the update from the php make a trigger to perform that action. When it's useful and when it isn't? ...

Need help with mysql duplicate rows problem

My query is this SELECT C.id, C.title, C.short_description,C.rating,C.image,C.duration,C.difficulty , 0 AS active , if(G.theme_id = 3,1,0) as orderField FROM tblIdeas C INNER JOIN tblIdeas_themes G on (G.Idea_id = C.id ) AND C.category_id = 2 and C.published = 1 and C.DELETED=0 and C.id != 4 ORDER BY active DESC , orderField DESC ,t...

how to create a Mysql db user with read access to filesystem

Hi, I'm trying to run mysql hot copy and I want to create a user account to run that process. However, whenever I create a user account (granting it specific priviledges) and run mysqlhotcopy there is always the error Unable to retrieve list of tables in {dbname}: DBD::mysql::db selectall_arrayref failed: Can't read dir of './{dbname...

Select from all tables

I have a lot of tables in my data base all with same structure. I want to select from all tables without having to list them all like so: SELECT name FROM table1,table2,table3,table4 And I tried but this doesn't work: SELECT name FROM * Is there a way to select all tables in a database without listing each table in the query? ...

PHP function display problem.

I'm trying to have my function display 3 links in a row then start a new row and display the other 3 links and so on but my code is not working right displaying my links all wrong. Current output. <div> <p> <a href="">A</a> </p> <p> <a href="">>A1</a> </p> <div> <p> <a href="">Glass &amp; M...

Explain to obtain the query time?

I trying to use command Explain to obtain the query time of my mySql database, however it return always 0.00sec, am i misunderstand the Explain command usage in mySql? Below is my command: mysql> explain select * from table; 0.00 sec mysql> select * from table; 15 sec why the explain wouldn't return the same query time result as ...

Is it possible to disable echoing query results to stdout in MySQL client?

I am using MySQL client interactively from a remote host. Is there anyway to mute the output of queries and save the output to a file instead? Using tee command in MySQL can save the output to a file but can't disable echoing. ...

How do I use MySQL transactions in PHP?

I'm sorry, this is a very general question but I will try to narrow it down. I'm new to this whole transaction thing in MySQL/PHP but it seems pretty simple. I'm just using mysql not mysqli or PDO. I have a script that seems to be rolling back some queries but not others. This is uncharted territory for me so I have no idea what is goin...

I am not able to read the records with null date field in MySQL using java?

here is the code private ResultSet rsResult; try { rsResult = DBProcess.statement.executeQuery("SELECT * FROM patients"); }//end try catch (SQLException ex) { out.println("<I>exception</I><br>"); Logger.getLogger(cUserLogin.class.getName())...

merge two rows and search in

Hi, I've used this MySQL query to get data: SELECT DISTINCT A.*, B.username FROM posts A, members B WHERE B.status=1 AND (A.USERID=B.USERID AND A.title LIKE '%myquery%' AND B.public='1' AND A.type = 'update' ) order by A.ID desc limit 0, 10 this works to search title row, but i need to search into title and msg row, how to "merge" (?)...

MySQL Dynamic Query Challenge - Help please!!

Hello, I have this query: SELECT userlist.USERID, (case when (sum( CASE WHEN track.OFFER_ID = 221 THEN 1 ELSE 0 END) > 1) then 1 else 0 end) offer_211 FROM userlist INNER JOIN track ON userlist.USERID = track.USERID group by userid This is the output: +------------+---------- | USERID | offer_211 | +-...