mysql

How to recover data from MySql Data files?

One of my servers' OS crashed yesterday. It was Win 2008.The server developed an HDD fault and did not boot. My host provider (Turnkey) has mounted the HDD on a Rescue system and given me access to the HDD through SSH. I have been able to download the Mysql data folder and all the MYD, MYI, FRM files. (MyIsam db?). I tried changing my ...

Handling dates prior to 1970 in a repeatable way in MySQL and Python

In my MySQL database I have dates going back to the mid 1700s which I need to convert somehow to ints in a format similar to Unix time. The value of the int isn't important, so long as I can take a date from either my database or from user input and generate the same int. I need to use MySQL to generate the int on the database side, and ...

order by two columns with same priority

Hi , i have table , contain firstname and lastname , i used in my query : ORDER BY FNAME,LNAME ASC , It display the records alphabetical order , and it works fine for Fname, but it is not giving the same periority to LNAME, my present table records : No Fname Lname 1 Agh Asd 2 Arh AAA 3 Bcvc Vvcv 4 Akasa Dvxvx ...

how to store "thai" language data in my SQL database

plz help me friends ...

How does MySQL evaluate Text and VarChar fields when compared to booleans?

Like select * from table where text_field; What would get pulled? ...

mysql two table query problem

a table a_id a_value 1 text1 2 test2 b table b_id b_num a_id 1 5 1 2 7 1 3 2 1 4 7 2 5 56 2 Results base a table (edited) a_id:1 a_value:text1 total:3 records a_id:2 a_value:text2 total:2 records How can get this format in sql? query a table and add a field(total) count b.a_id = a.a_id...

Efficient way to implement a user points system

hello everyone, i'm trying to find an optimied way of implementing a user highscore/points system based on different action the user performs. the system is like this: every user is performing different actions (posting an article, uploading some photos etc.). all this actions have their corresponding tables, so i know which user did wh...

Execute SQL script to create tables and rows

I have a database that I created using the CREATE DATABASE statement in the terminal and I have a .sql file full of statements creating tables and rows. I just wanted to know what was the command line to execute that .sql on the database I created? ...

mysql 2 queries into 1

$sql = $empire -> query("select * from issue where disabled='0' order by issue desc"); while($r=$empire->fetch($sql)){ //get total $total = $empire -> gettotal("select count(*) as total from sendbook where issueid='".$r["issue"]."'"); $list .= 'id: '.$r['id'].' issue :'.$r['issue'].' total:'.$total....

MySQL select all missing a record

I have added a new record to a table using phpMyAdmin I then run select * within phpMyAdmin and it works listing all records. However if run the same select * from a PHP page the new record is missing. I am using PHP 5 and am not sure what is going on here. It used to work in PHP 4. .php files run as PHP 5 Apache module mode. ...

Getting total number of rows using SQL_CALC_FOUND_ROWS in Zend DB Table Select

Is there a way to get the total number of rows in Zend db select like with using SQL_CALC_FOUND_ROWS in a regular mysql query. I haven't been able to find a similar functionality for this apart from running the same query without the limit clause. ...

Getting top distinct records in MySQL

Hi This is probably something very simple, so forgive my blonde moment :) I have a table 'album' * albumId * albumOwnerId (who created) * albumCSD (create stamp date) Now what I am trying to do is to select the top 10 most recently updated albums. But, I don't want 10 albums from the same person coming back - I only want one album ...

PHP+Ajax : Add-a-friend system

I'm trying to make a little project for adding friends. When you click the add friend button you are sending an Ajax call with the friend id & username (they are the id and name attributes of each add button) to the add.php file. (The mysql structure is: 1 users table + X tables named the user's name(columns: friendid, ispending)) In the...

MySQL How do you return the UNION of these two queries??

How do you get the UNION of these two queries: SELECT dom,sub FROM table WHERE table.dom = X OR table.sub = X SELECT dom,sub FROM table WHERE table.dom = Y OR table.sub = Y dom and sub are integers, both queries return a set of integers, how do you then get the union of these two sets?? Any assistance appreciated... ...

import initial table data to .mwb model file

hi, how can i import initial table data to .mwb file? i know that there is 'inserts' tab for each table, but i would like to import like 200 records and i don`t want to do this by hand :) ...

How to selete listbox with options in Ajax PHP jQuery

I have 2 tables in my database call groups and players i am trying to select the group first and then the players show up in another listbox. can anyone help me out please. DB Groups id Name 1 Red Group 2 Blue Group 3 Yellow Group Players id name group_id 1 ...

What is the best way to get all data if there are the same field names in other tables?

I have the following db. If I select * and join all the tables, desc and active will be mixed up. Now I can write all like omc_courses.desc, omc_trainer.desc etc, but if I have many field, it is not practical. So I am thinking if I can write like select *, omc_courses.desc AS course_desc, omc_trainer.desc AS trainer_desc, etc for fie...

Jquery autocomplete: Which is faster? (A) php/mysql/jquery or (B) html/json/jquery? I have two scripts, which is better/faster?

I have two autocomplete scripts, one of them makes use of (A) php/mysql/html/jquery and the other makes use of (B) html/jquery/json. I know that since they're using different technologies they might not be able to be compared directly, but from your own experience and from what you can gather from the pages these scripts are located on,...

mysql multiple update

Hi, basically want to have a multiple update based on a few conditions. So this is my sql query which returns error: Table have 3 columns: user_id, week and change INSERT INTO rank (user_id, week) VALUES (364709193,'201042'),(291179703,'201042'),(394613472,'201042'),(284220417,'201042'),(395465205,'201042'),(394807905,'201042'),...

Mysql how to use COUNT value of rows from joined table in WHERE statement?

Like that: COUNT(i.t_1) AS total_images WHERE total_images > 2 Throws an error: Unknown column "total_images" in where clause If this way: WHERE COUNT(i.t_1) > 2 Throws an error: Invalid use of group function How to do it right way? If need i'll post full statement. The meaning of this query to pick the 1 ad with the most p...