mysql

Creating a JSON object from multiple form fields using jQuery

Hi guys, I am trying to create a JSON object from a bunch of grouped HTML elements, this is my markup, HTML: <div id="locations_wrapper"> <div id="location_0" class="locations"> <div class="container"> <label for="locations_province">Province: </label> <div> <select id="locations_province" n...

Android widget vanishes from emulator on remoteviews update

My MySQL DB table holds a BLOB image with image_id as key. I am trying to do the following. 1.HttpPost("http://example.com/RetrieveImage.php") from Android App with the image_id in name value pairs. The PHP Script is as follows: <?php mysql_connect("host","userid","password"); mysql_select_db("database"); $q=mysql_query("SELECT image ...

How to get value from Combo Box PHP?

Hi there! I am using PHP 5 to create a query page for a MySQL database with 2 tables "students" and "teachers". I have created a combo box which can allow users to view and select the 2 tables from the combo box via a "submit" button after selecting from the combo box. However the problem with the script is that I want to verify if the ...

SQL: Comparing a whole row of data to a number

I'm basically logging data to an SQL database every minute, but I want to be able to check to see if there are any entries missing (ie: see if there are any differences greater than a minute). Take this for example: 5 4 2 1 I would want to display the rows where the 4 and 2 exist so that I know there is something missing between. The ...

Which MySQL schema would is optimal for this type of system

Assuming a system similar to Netflix where members create a wish list of movies and, based on their type of plan, one, two, or more of those movies in their list turn into orders, which one of the following schemas makes more sense? A controls table storing the following columns: controls(memberid, currentMoviesAtHome, moviesAtHomeLim...

Best practices for database testing with PHPUnit

PHPUnit's own manual has some as-yet-unwritten sections entitled "Operations" and "Database Testing Best Practices." What are best practices for testing a database with PHPUnit, particularly in MySQL? ...

CPanel: Allowing phpMyAdmin access only

I have CPanel access to a website with a MySQL database. My question is, I want to give another user access to the database but only through PhpMyAdmin and not the CPanel login. Is there a way? PS: (I am happy for this person to view, edit and download the data in Excel format) Cheers ...

COUNT and a sub COUNT in same query

Hi, I have 2 tables: members, orders. Members: MemberID, DateCreated Orders: OrderID, DateCreated, MemberID I want to find out the number of new members in a given month broken down into number of order groups, eg. 5+, 4, 3, 2, 1, 0 I've got the query to work out the number of orders for a member but how can I get these values in o...

Select adjacent records in Mysql

Assuming this table is ordered by date id | date | customer 3 | 2009-10-01| Frank 1 | 2010-10-11| Bob 4 | 2010-11-01| Mitchel 2 | 2010-11-02| Jim I would like to make a query so that knowing ID = 4 the resulting rows are $row[0]['id'] == 1 //previous $row[1]['id'] == 4 //most recent/current $row[2]['...

How to rename database without deleting or moving tables in mysql?

Possible Duplicate: How do I quickly rename a mysql database (change schema name)? hi , plz help me to rename the database name in mysql ...

can't send php form data info to other page

Hello All i have some php source it can send form data info to other page under mysql 4.x version. but after upgraded to mysql 5.x version, this php source can't send form data info to other page. i was searched many info, but don't have idea what's wrong with my php source. i just can guess this is related with mysql upgrade and i h...

Implementing arrays in MySQL

Is there any provision for creating arrays (variable length would be preferable) in MySQL . I need to create 2-3 lists for each user and update/append/delete items from the lists . How do I implement them? . Creating tables for each user will lead to a total mess in my opinion, but anyway I'm new to MySQL so please help me out . Thanks ...

How do i count and sum the values from the database.

Hi there, I have a table in mysql which holds the values in integers, my table is something like this. I want to sum up the values of a particular column, for example i want to calculate the total amount, total cashpaid and total balance. hwo do i do it? ...

How do i make this huge splitted queries into one single query.

Hi, there I have different queries fetching from different tables in one single page. i want to cut down the database tripping. here is my code.. $query = "SELECT COUNT(*) as cnt_news FROM news"; $result = mysql_query($query); $row = mysql_fetch_array($result); $query = "SELECT COUNT(*) as cnt_adv FROM advertisements"; $result = my...

Rotate table data with out update data

SELECT * FROM `your_table` LIMIT 0, 10 ->This will display the first 1,2,3,4,5,6,7,8,9,10 SELECT * FROM `your_table` LIMIT 5, 5 ->This will show records 6, 7, 8, 9, 10 I want to Show data 2,3,4,5,6,7,8,9,10,1 and next day 3,4,5,6,7,8,9,10,1,2 day after next day 4,5,6,7,8,9,10,1,2,3 IS IT POSSIBLE with out updating any data o...

In phpMyAdmin, constraints cause weird dropdowns when editing or inserting

I have added some constraints to some MySQL table fields. This seems to change phpMyAdmin a little bit, including constrained fields being presented as drop down boxes in edit or insert mode: This looks a bit weird to me, as if phpMyAdmin wants to add titles but doesn't have the correct information. Am I correct in this assumption? A...

Strange division problem on mysql

Look at the strange problem on MYSQL. Look at the column 3. The result is 0.02876121 but the actually result should be the column 4 = 0.02876. Why is MYSQL giving fault value on decimal points? *Another thing is that, it only give wrong value if I append "Where column = 'uniquevalue'" to return the result i want. The value is correct ...

mysql_num_rows(): supplied argument is not a valid MySQL result resource

if(mysql_num_rows($result)) { echo "no match found!"; } it is throwing an error- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\Hosting\6448289\html\includes\getQuestion.php on line 72 ...

Error when COUNT after MAX ?

Hi, I have a table Act in a medical database : IDAct Historic IDPatient 1 2001-01-01 1 1 2001-01-02 1 2 2001-01-01 2 3 2001-01-03 1 I would like to compute the column IDActPerPatient: IDAct Historic IDPatient IDActPerPatient 1 2001-01-02 1 1 2 2001-01-01 2 ...

What is wrong with mySQL Syntax?

Hi there, i am using the following code to count, and to sum the values from the database. $query = "SELECT COUNT(n.*) AS cnt_news, COUNT(a.*) AS cnt_adv, COUNT(c.*) AS cnt_comm, SUM(CASE WHEN c.approve = '1' AND c.spam = '0' THEN 1 ELSE 0 END) AS cnt_approved, SUM(CASE WHEN c.approve =...