mysql

Mysql - how to allow user to login?

As a root mysql user, I executed the following: grant all on mydb.* to john identified by 'john1'; Then from shell, I tried to login via mysql -h localhost -u john -pjohn1; But when I do this, I get the error ERROR 1045 (28000): Access denied for user 'john'@'localhost' (using password: YES) How do I allow john to login to the m...

Is there a working Cocoa MySQL Xcode project?

Or has this been abandoned? I can't seem to find a modern sample project. I haven't been able to make any the old code I find work. I just want to write a simple Mac app that accesses an external MySQL database that's also involved in a PHP website. ...

display array of dates as 12 month view

i work with php/Mysql i have table with two cols (date , cash) with values like {7/2001:100$, 12/2001:50$ , 1/2002:30$ , 5/2002:90$ , 6/2003:80$,9/2003:20$ } i would like to make cash flow table that have cols (Jan,Feb,Mar,............Dec) and row for every year in the date array and the value of cash in the table cells like blow . Ho...

parse results in MySQL via REGEX

Hi, I'm a bit confused on the functionality of the REGEX support for MySQL and I have yet to find a solid example on how to separate a result with REGEX within an sql statement. Example: How could I pull data from a table emails that looks something like... +-------------------------+ |Emails | |--------------------...

MySQL Date Time Issue

I have two date entities, start_date and end_date and now I want to find if current date is between my start_date and end_date, how can I do it in mysql ? ...

How could I rewrite this loop of Django queries as a more efficient SQL query?

This is an inefficient way to update a denormalized field on an Player Django model. The field essentially stores the position of the player on the leaderboard, which is a requirement for a system we have for displaying "nearby" players to a given player. for position, player in enumerate(Player.objects.order_by('-score')): player.p...

Translating a MySQL data/query-set into the equivalent Cassandra representation

Consider a 500 million row MySQL table with the following table structure ... CREATE TABLE foo_objects ( id int NOT NULL AUTO_INCREMENT, foo_string varchar(32), metadata_string varchar(128), lookup_id int, PRIMARY KEY (id), UNIQUE KEY (foo_string), KEY (lookup_id), ); ... which is being queried using only the following t...

Single MySQL query with count and sum

Hi there I have an SQL table that looks like this: CREATE TABLE IF NOT EXISTS `designerswave_article_visited` ( `article_visited_article_id` smallint(5) NOT NULL, `article_visited_user_id` smallint(5) NOT NULL, `article_user_rating` tinyint(1) DEFAULT NULL, UNIQUE KEY `article_id` (`article_visited_article_id`,`article_visited_...

Are there any linq-to-sql for Databases other than MS-SQL?

Hey =) I am wondering if it is possible to use Linq functionality to connect to a database like my-sql If it is possible are you able to use the designer to created the DataAccessLayer like with MS-SQL or do you have to hand code its content. Thanks in advance. KJ ...

Database Design

I'm trying to build out a mysql database design for a project. The problem is coming up with the best solution. Basically in my application, I will have to insert approximately 10-30 rows per user. The primary key will be a random CHAR(16) string. There will also be an datetime index, and an additional row (with an index) called "data". ...

Which mysql server package should I install?

I posted this question on serverfault but have not received an answer. Maybe someone here can answer this: I just switched hosts and now have the task of reinstalling everything. I'm on CentOS now and I need to install mysql but have no idea which package to install. I can't seem to find any info on the differences either. Would anyone ...

How do I do this "order by" in Django, if I have foriegn keys?

Suppose my model is this: class Ego(models.Model): event = models.ForeignKey(Event) user = models.ForeignKey(User) As you can see, this table has 2 columns, and they're both foreign keys. How do I "order by" User.first_name? Is this it? But it doesn't look like it. Ego.objects.all().order_by("User.first_name") ...

last_update timestamp for every table?

Is it a good practice to have timestamps for the last row update in every table? Or should they only be set where really needed? How do I know where I will need an update timestamp later? For which kind of information do they make sense? ...

Javascript and PHP to generate "live" print preview

I want to be able to enter data and use Javascript onChange/onBlur/etc to render a "live" print preview; with page breaks. The ultimate goal is to have a PDF file that can be saved/emailed/etc that will be identical to the "preview". The data is to be stored in a MySQL database, I'm figuring AJAX to write it while entry. Has anyone hear...

if mysql_query() fails, what to do?

Sometimes so happens that mysql_query() fails to INSERT data and I am unaware of it. So, the question is how do I know when it happens? ...

Error installing MySQL-python on MAC Snow Leopard, OS 10.6

Hello members, I am trying to install the MySQL-python on MAC OS 10.6 (Snow leopard, 64 bit). I followed the steps: 1. Installed MySQL for Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive. 2. Downloaded MySQL-python-1.2.3c1.tar.gz and unzipped it 3. CD to MySQL-python-1.2.3c1 and built it as: ARCHFLAGS="-arch x86_64" python setup.py bui...

How to omit "THE" in search using PHP and MYSQL

Hi all, I am doing a "ALPHABETICAL ORDER SEARCH" module for a project. that is it will look like A B C D E F . . . . . . . . . .. . . . . . . .. . . . Z When i click on "A" the results should be sort by "A". Which is same for all the alphabets. Now my prob is as follows: For example there is a film named "The Mummy". What i do i...

Actionscript 2.0, Having a SendAndLoad() function Issue

I have this code: btn_jouer.onRelease = function () { verif = txt_email_user.text; if (txt_email_user.text == "") { txt_erreur.textColor = 16724736; txt_erreur.text = "Champ(s) manquant(s)"; } else if (verif.indexOf("@", 0) == -1 || verif.indexOf(".", 0) == -1) { txt_erreur.textColor = 167...

SQL Query Problem

Hi Everyone, I've been at this for a bit now. Basically, I'm needing to add a derived column to count the hits to a weblog entry in the database. The problem is, the hits are being totaled and shown on only on the first record. Any Ideas? I've emboldened the parts of the query I'm talking about. The query is below: SELECT DISTINCT(t.en...

Zend DB: How to find the actual amount of affected rows with INSERT ON DUPLICATE KEY?

$db->update() returns the affected amount of rows. There is no Zend_DB method for insert ... on duplicate key update ..., so one should use the query() method: $result = $db->query('INSERT INTO table(key, field) SELECT val1, val2 FROM table as t2 ON DUPLICATE KEY UPDATE field = VALUES(field)'); To find out the amount of affected or in...