mysql

Mysql Color Scheme

Is there a way to set a color scheme for the mysql client? It might sound trivial, but I'd like to be able to set some level of colors for terminal client. ...

Can an attribute designate one table over another?

I'm creating a sports statistics database. With it, I'd like to catalog game/match statistics for many types of sports. For example, this database would be able to tell you how many touchdowns the Carolina Panthers scored in the 09-10 season (football), or how many free throws were made by the Miami Heat in their last game (basketball). ...

MYSQL selecting users with specific skills

Hi, I'm muddling my way through by far the most complex SQL query i've ever done, which is probably extremely simple for most of you (: I have three tables, User, Skills and User_Skills. The fields of which should be fairly self explanatory. I want to choose people who have one or more skills that meet my criteria. I can select a use...

Why does mysql_affected_rows return 0 even if one record should be updated

mysql_query("update users set balance=balance+'$pwbalance'-'$totalprice' where memberid='$memberid' and (balance+'$pwbalance'-'$totalprice')>=0")or die(mysql_error()); $count=mysql_affected_rows(); When I echo $pwbalance, it is 40.00; when I echo $totalprice, it is 40; So there should be one record to be updated. However, when I echo $...

How do I pull values between two datetimes at specific interval in MySQL?

I have an application that writes temperature values to a MySQL table every second, It consists of the temperature and a datetime field. I need to pull these values out of the table at specific intervals, every second, minute, hour etc. So for example I will need to pull out values between 2 datetime fields and show the temperature at ...

In MySQL, can I select all columns from one table and one from another?

In MySQL, I have a simple "SELECT * FROM foo" query. I would like to JOIN table 'bar', but: I only want one column from bar I specifically DON'T want the id column from bar, because it will conflict with the id column from foo I know that I could use as statements to avoid name conflicts, but I don't want to complicate things. Is the...

Getting the update row_count in mysql using php.

This is a very simple example: I have a table with two columns, id and password. I want to know when an update was done successfully, with success being defined as applied to an existing row. PHP seems to only offer mysql_affeted_rows(), which doesn't differentiate between 0 rows affected, and 0 rows updated. http://php.net/manual/en/f...

Why are my links not showing up via php email function?

I am trying to send notification emails(which is working fine) but have added the html headers to try to send links etc...for some reason nothing is showing up at all, just blank space where the desired links are supposed to be. Here is my code: if(isset($_POST['commentBlogSubmit']) && $auth) { $query = "SELECT `Email` FROM `Users`...

How to have a simple sticky position article list in a MySQL database that can be retrieved with only one query?

I have a paginated list of articles that needs to be sorted by rank but when an article has position <> 0 then it must be inserted in that specific position. I thought that I can at least have the articles with the correct position extracted for the current page and then sort them in PHP to show then in the proper position. I want to do ...

Query result organization

I am trying to figure out the most efficient way to format this query. I have three tables - Transaction, Purchase and Item. The desired result is to select sales data (quantity/sales total) for each item for a specific client. the tables are formatted as follows: (=primary key)* Transaction: Transaction_ID*, Timestamp Purchase: P...

I need the metadata from a mysql resultset, is this possible?

I'd like to obtain the metadata from the results of a mysql query so I can put it into a datatable in c#. I primarily need the column name and the data type. Here's a simple example. show columns from ( select sum(subtotal) as subtotal , sum(tax1+tax2+tax3+tax4) as tax , sum(subtotal)+sum(tax1+tax2+tax3+tax4) as total from tbltrans...

empty file problem [solved]

REWROTE: SOLVED Hi there, I currently worked on a simple application with a database, a bunch of controllers, views and a model class. I coded the controllers and inserted the db connections directly E.g. Each controller method has his own PDO to connect to a specific database+table. I refactored this because I had too many active P...

Is there an database connectivity framework or library for PHP?

I wonder if there's a useful library or lightweight framework only for database connectivity. What I need is something that lets me use a MySQL database with prepared statements in a secure way, without thinking a lot about gcc_magic_quotes and stuff like that. Something object oriented would be nice to have, with some convenience when f...

MySQL install on OSX, I want to start again, is it safe to delete all mysql folders?

I want to start again with attempting to install MySQL on OSX, I typed this to find all folders find / -name mysql. Is it safe just to delete all of the folders that I found? /opt/local/include/mysql5/mysql /opt/local/lib/mysql5/bin/mysql /opt/local/lib/mysql5/mysql /opt/local/share/mysql5/mysql /opt/local/var/db/mysql5/mysql /opt/loca...

MAC OSX, which version of MySQL should I download?

I have a MAC OSX 10.6, intel 64 bit, I'm looking at the mySQL download options at http://dev.mysql.com/downloads/mysql/5.1.html#macosx There are no download options for 10.6, do you think the 10.5 downloads below will work? Mac OS X 10.5 (x86) Mac OS X 10.5 (x86_64) Cheers ...

Little help with making this basic search function work (Zend Lucene)

I have two php files so far, test.php: <?php include("../config_conn_fordon_db.php"); include("../config_open_db.php"); // Fix Special Characters mysql_query("SET NAMES 'utf8'") or die(mysql_error()); mysql_query("SET CHARACTER SET 'utf8'") or die(mysql_error()); $root = realpath($_SERVER["DOCUMENT_...

MySql: transactions don't detect deadlocks?

Consider the following perl code: $schema->txn_begin(); my $r = $schema->resultset('test1')->find({id=>20}); my $n = $r->num; $r->num($n+1); print("updating for $$\n"); $r->update(); print("$$ val: ".$r->num."\n"); sleep(4); $schema->txn_commit(); I'm expecting that since the update is protected by a transaction, then if two proc...

Storing UTF8 data in MySQL

When storing data in mysql using the UTF8 charset, does it make sense to escape entity characters when the data is being input or is it better to store it in raw form and transform it when pulling out? For instance, let's say someone enters a bullet () character into a text box. When saving that data, should it be converted to &#8226; b...

SSIS Query Parameters for ADO .NET Source

I am trying to retieve data from a MySQL table and insert into a SQL Server table using ADO .NET connections in SQL Server 2008 SSIS. In my data flow task I have an ADO .NET Source which queries the MySQL table (select all invoices) and an ADO .NET Destination which inserts the data in my SQL Server table. Now, I would like to add a para...

Comparison of database column types in MySQL, PostgreSQL, and SQLite? (Cross-Mapping)

I am trying to find some way to relate column types across the the most used Databases: MySQL, PostgreSQL, and SQLite. Here is what I have so far, but I'm afraid it's not done and I need some people with more experience to help me finish any missing types. MySQL PostgreSQL SQLite TINYINT SMA...