mysql

MYSQL: User - profile details table setup - best practice

Next to your normal user table "user"(user_id/user_email/user_pwd/etc), what is the best way to go to story profile information. Would one just add fields to the user table like "user"(user_id/user_email/user_pwd/user_firstname/user_lastname/user_views/etc) or create another table called "profiles"(profile_id/user_id/user_firstname/use...

number of occurrences of found matches in fulltext search

i am curious whether in a regular fulltext search mysql_query("SELECT post_subject,topic_id,forum_id,post_text FROM phpbb_posts WHERE MATCH (post_subject,post_text) AGAINST('".$dtitle."') GROUP BY post_subject LIMIT 50")or DIE(mysql_error()); i am able to get the result of number of found matches to sort by. so i could do something...

How can i update a table using SQL Injection?

Hi all, How can i able to update a table in a MySQL database using SQL Injection? I have heard about how we can enter the query in the address bar and it is possible to update a table in the MySQL database. But I am not sure about it. Kindly give me an idea professionals... ...

Why 'foreign key constraint fails' when foreign key exists?

I have a simple query UPDATE `t_timecard_detail` SET `timeoff_request_id` = 'adad8e0d-c22b-41c3-a460-6cf982729299' WHERE `id` = 'cfc7a0a1-4e03-46a4-af89-069a0661cf55'; which gives this error ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`demo1_timeapp`.`t_timecard_detail`, CONSTRAINT `timeoff...

Sorting results by 'most relevent' - MYSQL & PHP

I've never really considered this question before and wondered if anyone has any advice or input on best practices for achieving 'relevent results'. In my case I'm running a search query that includes full text searching across 5 fields, a geographic radial lookup and a number of basic comparisons. I can prioritise the fields I'm most ...

Searching MySQL Bin Log for a Query

Is it possible to query the mysql bin log for a particular query? For example, suppose I want to know if anyone in the last hour did a specific query (like 'Update tableX where userName = 'bob'"). I just want to see if a particular query has been run recently..... ...

What is maximum records quantity a MySQL table can store?

How many records can a MySQL MyISAM table store? How many InnoDB can? ...

speeding up outer join query for newsletter script

Hi, I've got a PHP script that sends newsletters to a bunch of email adresses, it sends 15000 newsletters an hour, until all email adresses have been processed. Because this process isn't run in one time, I have a table where I register all the adresses which have been mailed, so I can always easily get the unmailed adresses. Here is...

PHP/MySQL Query In a loop, how to append to just one query?

I have a query to pull all articles out of the database.. $get_articles = $db->query(" SELECT *, a.id AS id, s.type AS type FROM ".$prefix."articles a LEFT JOIN ".$prefix."sources s ON (s.id = source_id) WHERE a.type!='trashed' ORDER BY a.timestamp DESC LIMIT $start, $end"); Within the loop of this query, I do then do an...

How do I use num_rows() function in the MySQLDB API for Python?

I have this statement cursor = connection.cursor() query = "SELECT * from table" cursor.execute(query) res = cursor.fetchall() ...

Convert MySQL to SQlite

Is it possible to convert from MySQL to SQLite with a free tool on windows? ...

Mysql remote synch

Hi, We currently have an application located on a remote server, and our call center uses this application to perform customer transactions. We plan to setup asterisk on a local server to help us with all the call routing and recording, for asterisk to work smoothly we have to move our application from the remote server to the local. ...

parse an rss feed and update/insert/delete rows

Hi all I'm trying to parse multiple RSS feeds and If they change, thus update my records in my MySQL table. Currently, I have a script that inserts items of RSS Feeds (just post in the url in a form and submit). This inserts the following into my table: title, rss_url, description, price, discount, total This all works perfectly well....

MySql return only one instance of duplicate entries

Hi I have a table with names and numbers entered along with other data . The table called events contains many instances where the name and numbers are the same but the other entries are different. I want to perform a search using names so I can display the number. But in my search I only need to return one instance of a name . The table...

How to join four tables with MySQL

I have omc_projects, omc_logs,omc_specs and omc_files. All of omc_logs,omc_specs and omc_files table has a field called project_id. CREATE TABLE IF NOT EXISTS `omc_projects` ( `id` int(10) NOT NULL AUTO_INCREMENT, ... PRIMARY KEY (`id`) ) ... ; CREATE TABLE IF NOT EXISTS `omc_files` ( `id` int(11) NOT NULL AUTO_INCREMENT, `p...

is it possible to automatically delete a row in a table if a certain condition is met?

is it possible to automatically delete a row in a table if a certain condition is met? for example a products table pid pname quantity 1 shoes 5 now the condition must be if quantity is equal to 0 then the whole row must be deleted ...

Expiring memcached using mysql proxy when an update occurs?

Hi guys, I have mysql Proxy running which takes a query, performs an md5 on it, and caches the result into a memcached DB. the problem occurs when an update happens in the rails app that would invalidate that cache. Any ideas on how to invalidate all of the proper keys in the cache at that time? ...

html tags in mysql value fields, is that right ?

i was looking at status.net source code and mysql tables, and they seem to have html tags in thier mysql field values, i was just wondering is that right thing to do or is it going to cause some problems in the future? ...

MySQL: Should my user ID be INT auto-increment primary key starting at 1?

I'm a beginning programmer, building a non-commercial web-site. I need a user ID, and I thought it would be logical to use for that a simple INTEGER field with an auto-increment. Does that make sense? The user ID will be not be directly used by users (they'll have to select a user-name); should I care about where they start at (presum...

Looking for a basic PHP / MySQL search class.

Noob-ish question: I'm looking for a lightweight but decent php way to search all fields of a MySql table, regardless the structure. I first gave it a try on my own with the default mysql select but that's too basic. I'm looking for something that should at least order results by best match (keyword highlighting would be nice too). I'm ...