mysql

NHibernate CreateSQLQuery data conversion from bit to boolean error

Hi, Im being a bit lazy in NHibernate and using Session.CreateSqlQuery(...) instead of doing the whole thing with Lambda's. Anyway what struct me is that there seems to be a problem converting some of the types returned from (in this case the MySQL) DB into native .Net tyes. The query in question looks like this.... IList<Client>...

database design programatically handling incrementing ID field, scalability - confused

Hey, If I am building a multi-shop e-commerce solution and want the orders table to maintain a shop based sequential ID, what is the best way of doing this? For instance imagine these order IDs in sequence: - UK0001 UK0002 UK0003 DE0001 UK0004 DE0002 etc. through grouped PK ID MySQL / MyISAM - MySQL will manage this automatical...

How to change date formate in mysql stored procedure insert statemant "22-12-2010" to "2010-12-22"

I send the registration date parameter to mysql database like "22-12-2010". But my sql date date type is in another formate how can i change the date formate like "2010-12-22" also i have to insert this into table. Give code in c#,asp.net code behind either sql query statement! Cheerss!!!!! **Thanks A.Ayy...

Django Test Failing

Hello all! I am experiencing an error running django unit tests, I've not experienced this before, and have been googling it all afternoon. I am getting this error in terminal after running django manage.py test: Error: Database test_unconvention couldn't be flushed. Possible reasons: * The database isn't running or isn't configured...

Recalculate Counter Cache of 120k Records [Rails / ActiveRecord]

The following situation: I have a poi model, which has many pictures (1:n). I want to recalculate the counter_cache column, because the values are inconsistent. I've tried to iterate within ruby over each record, but this takes much too long and quits sometimes with some "segmentation fault" bugs. So i wonder, if its possible to do th...

How do I create a timed ban on an account? (PHP/mysql)

I want to create a function that allows me to ban an account for 10days. In the dbc, I have a field called "ban" and Boolean of 1=notban, 0=ban. I also have a field called "date_banned" which is just the timestamp of when the user got banned. My question is how do I create a time frame of 10days from the date the user was banned? ex:...

MySQL & PHP Tagging

Hi, I'm creating a webapp. I want to support tags. How have to be the MySql table?. I want to relate a link, with various tags. Thanks. ...

Import mysql database in osx

Hi, I have a mysql dump generated from phpmyadmin in a windows environment, when i try to import in osx (using mysql command line) there are encoding problems, the databases have the same encoding and collation. I've also noticed that this problems occurs also when i try to import a diferent database from a unix virtual machine. When ...

MySQL: How to copy rows, but change a few fields?

I have a large number of rows that I would like to copy, but I need to change one field. I can select the rows that I want to copy: select * from Table where Event_ID = "120" Now I want to copy all those rows and create new rows while setting the Event_ID to 155. How can I accomplish this? ...

I have a problem with mysql and php

Hi I have a problem, this is my code: $db = new mysqli("localhost", "root", "", "blah"); $result1 = $db->query("select * from c_register where email = '$eml' and password = '$pass'"); if($result1->fetch_array()) { $auth->createSession(); $_SESSION['user'] = 'client'; promptUser("You have successfully...

QSqlQuery UPDATE/INSERT DateTime with server's time (eg CURRENT_TIMESTAMP)

I am using QSqlQuery to insert data into a MySQL database. Currently all I care about is getting this to work with MySQL, but ideally I'd like to keep this as platform-independent as possible. What I'm after, in the context of MySQL, is to end up with code that effectively executes something like the following query: UPDATE table SET ...

How can I get around MySQL Errcode 13 with SELECT INTO OUTFILE?

I am trying to dump the contents of a table to a csv file using a MySQL SELECT INTO OUTFILE statement. If I do: SELECT column1, column2 INTO OUTFILE 'outfile.csv' FIELDS TERMINATED BY ',' FROM table_name; outfile.csv will be created on the server in the same directory this database's files are stored in. However, when I change my ...

json_encode with mysql content and umlauts in utf-8

Hey, i feel my beard growing while trying to find out the Problem here. Basic the Problem is, that Umlauts/Special Signs äöß ... don't work. I guess everyone is sick and tired of that questions but all the solutions found online don't seem to work. Im having utf-8 content in a utf-8 Mysql Database. I feel the Problem ist somewhere in ...

Best way to handle JSON timeout

Currently I am pulling a JSON feeds from numerous APIs using jQuery, but what is the best way to handle the possibility of a service not responding or timing out because of their server? Would it be better to cache the JSON on your server? I'm using PHP/MySQL so I'd like to see an example if a server-side solution is the way to go. ...

Removal of table primary key in MySQL

Hello, I've removed the primary key of one table of my MySQL database, but now, when I use the MySQL Administrator and try to edit some data of this table, it doesn't allow me to do this. The button edit that appears in the bottom of the table keeps visible, but disabled to click. ...

How to parse a "Mysql result JSON String" in Javascript?

Is there a way to convert it into object form? So that each field of the result can be accessed results[i].field where i is the number of records in the mysql result.. This is my JSON String http://pastebin.com/Cky1va3K ...

MySQL: Records inserted by hour, for the last 24 hours

I'm trying to list the number of records per hour inserted into a database for the last 24 hours. Each row displays the records inserted that hour, as well as how many hours ago it was. Here's my query now: SELECT COUNT(*), FLOOR( TIME_TO_SEC( TIMEDIFF( NOW(), time)) / 3600 ) FROM `records` WHERE time > DATE_SUB(NOW(), INTERVAL 24 HOU...

How do I assign a rotating category to database entries in the order the records come in?

I have a table which gets entries from a website, and as those entries go into the database, they need to be assigned the next category on a list of categories that may be changed at any time. Because of this reason I can't do something simple like for mapping the first category of 5 to IDs 1, 6, 11, 16. I've considered reading in the ...

How to create wordpress-like option table and get values for each row?

Hi guys. I'm looking to create an options table in my db that makes every record a system option, so I can work with a little number of fields. My db has the following structure: 3 columns named id, name, and value The following data is inserted as an example: +--+-----------+--------------------------+ |id|name |value ...

TinyText VS LongText !!

Maybe this is a very stupid question but... Why should I use tinytext and not longtext ? In tinytext I can save only 255 chars. ...