mysql

GROUP BY shows all distinct columns

mysql> select * from products; +---------+-------------+-----------+------+ | prod_id | prod_source | prod_type | flag | +---------+-------------+-----------+------+ | 1 | USA | 2 | 0 | | 2 | USA | 2 | 0 | | 3 | USA | 2 | 0 | | 4 | USA | 3 |...

How to represent the data for threaded comments(along with comment voting) in mongodb?

For my blog, I want to incorporate my own commenting system without relying on the default wordpress commenting system. I need the comments module to utilize mongodb instead of mysql and the module needs support for the following: Threaded comments Comment Voting The votes on comments need to be aggregated per each comment author f...

mysql qt in linux and windows

On a centos, qt creator 1.2.1 qtsdk-2009.04 what step by step is needed to create mysql driver, in linux and in windows. such that running following command gives an positive output QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("xxxxxxxxxx"); db.setDatabaseName("xxxxxxxdb"); db.setUserName("xxxxxxxxxxx"); db.se...

PHP mysql connection?

can any one tell me the difference between mysql_connect and mysql_pconnect? ...

php compare or mysql data?

I not sure which one would use less execution time if the user is advertising a classifieds ad and did not upload any image, a 'blank.jpg' would replace the image in HTML code. which is: <img src="blank.jpg"> For the PHP, I use if-conditional when read data from mysql and replace '0' value with 'blank.jpg', would it be optimal if the d...

Give another name for column in Mysql

I'm integrating 1 script as backend for another. Both the scripts uses PHP/Mysql. There is however one catch as in the "Users" table the frontend uses "id" for the user's id & the backend uses "uid". Is there any way to give two names for the same column so that the modding can be done easily ? ...

how to display images stored in a mysql database using PHP

I have been trying to display image from database using php but i am only getting download prompt whenever i use or click the link. what i want to do is, i want to display it on the web browser. And want to use it in tags. my code is: require_once('dbconfig.php'); $cont=mysql_connect($dbhost,$dbuser,$dbpass) or die("Error Conn...

MySQL Query: Long time spent in 'init' state

I'm performing an update on a MySQL table (myisam engine) that, according to the profiler, is spending an inordinate amount of time in the 'init' state: mysql> show profile for query 2; +----------------------+-----------+ | Status | Duration | +----------------------+-----------+ | starting | 0.000057 | | ch...

Mysql Partitioning and prunning issue version 5.1.40

Hi All, MYSQL running on my machine is V-5.1.40 I am able to partition the Table as i wanted but when i am trying to query using the key which i used to partition the table it does not take effect it still considers all the partitions below is the code i used and its o/p respectivly ALTER TABLE testTable REMOVE PARTITIONING; ALTER T...

Server IPC design issue

Hi, i have a design issue regarding sending user data from a mobile phone app to a server (Debian 5 LAMP). I need to send various details such as username , date of birth, customer order no. etc. These will be passed onto a C code app (always on process)running on the server. I am currently using named pipes for IPC between my external ...

how to replace an element in every column of database table?

Hello, I am not a guru of databases, do most of the things through PHP, like data manipulation as well, even if it is an internal task. However, PHP is not being very useful in this case. I have a table with about 0.4 million records in it and it has like 16 columns, everything else works fine but I populated this table from a text file ...

MySQL with Soft-Deletion, Unique Key and Foreign Key Constraints

Say I have two tables, user and comment. They have table definitions that look like this: CREATE TABLE `user` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `username` VARCHAR(255) NOT NULL, `deleted` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY (`username`) ) ENGINE=InnoDB; CREATE TABLE `comment` ( `id` ...

how to put a limit on a while mysql_array?

//check which faction members are online $sql = mysql_query("SELECT * FROM ".TBL_ACTIVE_USERS." WHERE faction=$userfaction_id ORDER BY timestamp DESC,username"); //no '' around var as it is an integer, so php doesn't expeect it to be string $numrows = mysql_numrows($sql);//gets number of members online if($numrows == 1){ echo 'You are t...

PHP Class to draw a competition playoff table in HTML

Hi all, I'm looking for a PHP class that would draw me (by fetching data from a mysql table) a competition playoff table in HTML similar to what they do on wikipedia (see under the "Bracket" section): http://en.wikipedia.org/wiki/2009%E2%80%9310_UEFA_Europa_League_knockout_phase Any input? Thanks ...

MySQL : Multiple row as comma separated single row.

Hi, I have two tables : DISH and DISH_HAS_DISHES. Dish table has all the dishes and "Dish_has_dishes" table has a one-to-many relationship with "Dish" table. I.e. a dish can have multiple dishes. For example DISH : dish_id dish_name 1 dish_1 2 dish_2 3 dish_3 4 dish_4 DISH_HAS_DISHES : meal_id d...

Need help with PHP and MySQL

I have a table which has a column with numbers (no specific order). What would be the shortest way to insert the minimal number in this column into $min variable in PHP ? ...

Mysql Query Incorporating Self Referential Join

Say I have four tables: ------------- features -------------- id: int name: varchar ------------------------------------- -------- feature_categories --------- feature_id: int category_id: int ------------------------------------- ----------- categories -------------- id: int name: varchar -------------------------------------...

Uploading multiple files per field and storing in a db with codeigniter

Hi, I have a form which uploads multiple file fields into a db using codeigniter. I need to be able to upload multiple files for each field. I understand that this could be achieved using some jquery magic, however, my problem is how do I intercept the multiple files and what is the best way to store them in my database? At the minute...

SQL: How to select 1st, 3rd, 11th and nth row from a table?

How to select 1st, 3rd, 11th and nth row from a table? ...

MySQL ODBC Connector Error

I try to execute the following command and receive this error: [root@localhost ~]# isql -v asterisk-connector [01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/libmyodbc.so' : /usr/lib/libmyodbc.so: cannot open shared object file: No such file or directory [ISQL]ERROR: Could not SQLConnect I have checked and libmyodbc.so does...