mysql

MySQL Fulltext search and score not pulling up results

Hello all, I put together a very simple search engine based on an article un zend's website using fulltext. My understanding is that if a keyword scores 50% or more, this will be dropped. This is good, but I know my client is not going to like it. I know they expect some keywords to be shown within a search result. My main problem is th...

mysql show rows in order from highest value to lowest value

I have a table that contains a column named views. Each time the user refreshes the page, it updates the view count +1. What im trying to do, is create a mysql query to output the list of rows based on their views count, from highest to lowest. this is what i thought would work SELECT * FROM picdb ORDER BY views DESC LIMIT 10 even wh...

MySQL - storing images in a database??

Lets say each row of our table contains information about various vehicles for sale. And each user can store several images of each vehicle. What might be a good approach to storing these images? Duplicate: User Images: Database or filesystem storage? Duplicate: Storing images in database: Yea or nay? Duplicate: Should I store my image...

Are nested inline forms possible in Django Admin models?

I was about to ask essentially the same question as this one. However, since no one answered it, I'll assume that nested inline forms aren't possible. So instead I'll just ask how you would approach designing something like this in Django: A retailer sells clothing. Each sweater design has a Style number. This style is available in di...

complex sql tree rows

table structure id | message | reply_id 1 | help me! | 0 434 | love to | 1 852 | didn't work | 434 0110 | try this | 852 2200 | this wont | 0 5465 | done. :) | 0110 i have a id "852" which is middle of tree menu, but i want to get all the previous related and next re...

Recent web attack and use of ?? in prepared MySQL statement

I recently had an attack on my site and the attacker tried to alter one of my SQL statements, by adding the following string %2f%2fcomponents%2fcom%5fvirtuemart%2fshow%5fimage%5fin%5fimgtag%2ephp%3fmosConfig%5fabsolute%5fpath%3dhttp%3a%2f%2fwww%2ekwangsung%2ees%2ekr%2f%2fUserFiles%2fshirohige%2fzfxid%2etxt to a value. Anyways, I don...

Synchronizing N Values Accross Tables in SQL.

Disclaimer: I just started with databases, so I'm probably missing something extremely trivial. I have two (somewhat related, but not enough to be a single table) tables: table_one and table_two. table_one has two columns of significance: name of type varchar(n) intersects of type bit table_two has one column of significance: n...

Why does this pdo::mysql code crash on windows??

Why does this pdo::mysql code crash on windows??? <?php $username = "root"; $password = ""; try { $dsn = "mysql:host=localhost;dbname=employees"; $dbh = new PDO($dsn, $username, $password); $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected to datab...

Counting children in another table for each row

I have two tables: CATEGORY and SUBCATEGORY Table Structure for CATEGORY category_id int(11) category_name varchar(250) category_status enum('0', '1') Table Structure for SUBCATEGORY subcategory_id int(10) subcategory_name varchar(255) status enum('0', '1') For example there is a single...

Building a Large Table in MySQL

This is my first time building a database with a table containing 10 million records. The table is a members table that will contain all the details of a member. What do I need to pay attention when I build the database? Do I need a special version of MySQL? Should I use MyISAM or InnoDB? ...

Storing distances in MySQL

I have a "colors" table in my database. The user enters a color trough the user interface, and the backend searches for the most similar looking color existing in the colors table, calculating the distance of the colors in the HCL space. I will implement a caching algorithm, which should store the distance between previously calculated...

Normalization in MYSQL

Could anybody help me to know what is normalization in mysql and in which case and how we need to use it.. Thanks in advance. ...

Select from sql in condition that a certain column is start with a certain string.

I am using sql. How to select all items from a table. where a column (varchar) path is start with a certain string : "stringABC" select * from ATable where path like 'stringABC'; The above sql is wrong, can any one help me to fix it? Many thanks! ...

Access policy in PHP and MySQL.

I am slightly confused on how to setup my table. I have three roles which can be selected through checkbox. While registration.... if user selects one and two... then those pages should be visible, if he selected one and three then those pages and if selects anyone of them then those alone... Let us name the page 1 as client management...

Post SELECT element value

Hi! I use jquery to post data to mysql. **In settings.php i have this short JS code:** $("form#submit").submit(function() { var fname = $('#fname').attr('value'); var lname = $('#lname').attr('value'); $.ajax({ type: "POST", url: "settings.php", data: "fname="+ fname +"& lname="+ lname, success: function(){...

how to Sql return only all duplicated entries

i have a table having create table test(id int not null primary key, day date not null); insert into test(id, day) values(1, '2006-10-08'); insert into test(id, day) values(2, '2006-10-08'); insert into test(id, day) values(3, '2006-10-09'); select * from test; +----+------------+ | id | day | +----+------------+ | 1 | 2006-1...

sql pulling a row for next or previous row of a current row

id | photo title | created_date XEi43 | my family | 2009 08 04 dDls | friends group | 2009 08 05 32kJ | beautiful place | 2009 08 06 EOIk | working late | 2009 08 07 Say I have the id 32kJ. How would I get the new or previous row? ...

Convert binary string to bigint in MySQL?

I am attempting to hash a string to a 64-bit value (bigint) in MySQL. I am aware of the MD5() function, which returns a 128-bit hash as a binary string. I'd be happy to just take the bottom or top 64 bits of this result. However, I cannot figure out how to get from a binary string type to a numeric type of any sort. Any pointers? ...

Two Table Query Slow: File Sort Problem

I'm trying to query the latest entries on two different tables as one query: SELECT news.title AS news_title, news.sid AS news_id, downloads.lid AS download_id, downloads.title AS download_title FROM news, downloads ORDER BY news_id DESC, download_id DESC LIMIT 0,10 The query is really slow and it s...

MySQL performance – Multiple queries or one inefficient query?

Hi. I have three tables, each contain some common information, and some information that is unique to the table. For example: uid, date are universal among the tables, but one table can contain a column type while the other contains currency. I need to query the database and get the last 20 entries (date DESC) that have been entered in ...