Have two id user tables and the link between them

I have the first table 'users' | id | name ------------------ | 1 | james | 2 | johnny | 3 | Carl | 4 | Lea And my second table contain the linked users linked_users | id | linked_id -------------------- | 1 | 2 | 1 | 4 | 2 | 3 I need to get two fiel

MySQL - create a line and update if it already exists

I have table with 4 columns: Date, John, Frank, Anthony I want to make a form which can be filled in by these 3 people everyday and store these values in the database. When John fills in the form today, a new row should be created with the date of to

Only the first item appears in Fill list from asynchronous task

Hello i am trying to build a listview and populate it from values in Mysql database. The list with SimpleAdapter works but i decided to change the listview and use my own adapter that extends ArrayAdapter and create my own listItem and not the HashMa

Mysql multi-line queries

I'm new to MySQL and I am facing a little problem that I couldn't find an answer to in any previous thread here, so I was hoping someone could help, okay here it is: When typing a request on mysql (on the terminal) you can just press enter to make it

PHP date of database as time stamp - add X hours

I have Googled and I give up, here goes... I have always had issues dealing with times/timestamps etc, I am trying to pull a date from my database in SQL TIMESTAMP format, this is what I have so far... $db = $row_rsSearch['created_date']; $newdate =

Paging problem when sorting based on the last modified property

I need to show some records sorted based on modified column (latest activity on top) (Post with new edit or comments at the top) App UI has twitter like 'more' post button for infinite scroll. each 'more' will add next 10 records to UI. Issue is that

Could the SQL injection be done in this case?

This question already has an answer here: How can I prevent SQL injection in PHP? 28 answers I have been fussing around with my PHP code and SQL statements and while I do know that one could use prepared statements when dealing with this, I still won

How to optimize when Mysql uses count (distinct) and attached

I have two table,their structure are below : CREATE TABLE `metaservice`.`user` ( `id` bigint(18) NOT NULL AUTO_INCREMENT, `userId` bigint(18) NOT NULL, `name` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `userId` (`userId`) USING BTREE, K

Work on a simple CMS - how to manage which access to the user?

I'm working on a personal CMS and I've got a problem. I wanted to define access levels such as CAN_DELETE_THREAD, CAN_EDIT_MESSAGE or CAN_CREATE_THREAD as binary flags, but I don't know how a function 'has_flag' would work. For example, if I took a u

Why am I getting this result?

SELECT * FROM afspraken WHERE user_id = '2' AND datum > '2012-06-05' OR ( user_id = '2' AND datum = '2012-06-05' AND begintijd >= '22:47' ) ORDER BY datum DESC , begintijd ASC This above is my query.. And while i should get zero result i still get o

the lines of the mysql group in the joined query

Im stumbling upon a problem where i need to retrieve data from the following tables events +-------+---------+---------+ | e_id | e_title | e_link | +-------+---------+---------+ | 1 | Event 1 | event_1 | | 2 | Event 2 | event_2 | | 3 | Event 3 | eve

Comparison of PHP / MySQL schedules

I have an idea for a project that I am currently working on, I am however struggling to find a way to implement this in PHP/MySQL. I have a database with a list of activities that a tattoo parlour has, basically he works from 9 to 5 and when an event

Calculation of short distances between lat / long points

I have a MySQL table with Spatial Points, and need to calculate distances. I found lots of material on doing this using the Haversine formula, however all of these assume a large distance between points. In my case, I only care about short distances

Multiple INSERT does not work

I have multiple If statements that if true, inserts data into the db. The Problem is that the 2nd one of the INSERT statements inserts it 4 times. How would i stop it from adding duplicates. Also the returned $_POST['tshirt'] contains only one value

MySQL Street Address Blurred Search

Does anyone know of a good script (or good strategy) for doing a fuzzy street address search on a MySQL database? The key issues are: capitalization (easy -- just use LCASE) punctuation (could use REPLACE; not sure it there are more efficient options

PHP OOP: How to use a generic MySQL class in other classes

I've just started using OOP PHP and ran into a question. I've set up a generic mysql class that allows me to connect to a database and has some functions to obtain records from a table: class mysql{ //some lines to connect, followed by: public functi

prob. with tquery.requestlive

Do anyone know how to request a "live result set" in MySql when query has offset(eg: select * from table limit 10 offset 20;). it is throughing an error like 'invalid use of keyword' . Thanks, Vijay.you have no condition behind where and before

How to use a naming convention for large databases?

I am busy developing 2 web based systems with MySql databases and the amount of tables/views/stored routines is really becoming a lot and it is more and more challenging to handle the complexity. Now in programming languages we have namespacing e.g.

Return a record of a subquery in a result set

I am attempting to return a rowcount from a subquery as part of a result set. Here is a sample that I've tried that didn't work: SELECT recordID , GroupIdentifier , count() AS total , (SELECT COUNT() FROM table WHERE intActingAsBoolean = 1) AS Approv