Scenario
I have a search facility on a website that sells products.
The page is built with PHP and MySQL searching against a Merged View that joins 10+ tables together. There are approx 12,000 records in the view with 20+ fields each.
A user can search for products matching a specific criteria using multiple (10-15) select menus.
The...
"We should never trust user's input", this is what I read from somewhere on the web.
Currently I have a web form, they enter their username and emails. For username field, how to control, check and prevent mysql injection?? Currently, in my php script I only do this:
$username = mysql_real_escape_string($_POST['username']); // prevent ...
The column which defined with char type in a create table sentence is defined as varchar()
It was defined as char(8) convert to varchar (8) in desc on DB.
char(1) -> char(1) on same DB
When it defined a table of the char type more than 2 bytes, to convert for varchar()
is specifications in MySQL 4.1?
...
Hi All
My PHP script generates a table with rows which can optionaly be edited or deleted. There is also a possibilety to create a new Row.
I am having a hard time to figure out how to update the HTML rows which are generated through PHP and inserted via jQuery. After the update it must be still editable. The HTML is generated into a d...
Hi guys, I've built a simple cms with an admin section. I want to create something like a backup system which would take a backup of the information on the website, and also a restore system which would restore backups taken. I'm assuming backups to be SQL files generated of the tables used.
I'm using PHP and MySQL here - any idea how ...
I have a column that has comma separated data:
1,2,3
3,2,1
4,5,6
5,5,5
I'm trying to run a search that would query each value of the CSV string individually.
0<first<5 and 1<second<3 and 2<third<4
I get that I could return all queries and split it myself and compare it myself.
I'm curious if there is a way to do this so mysql ...
What is the first day of the week in mysql, Monday or Sunday??
I want to do this: (i am using php btw)
Get today date (no problem)
Display information of this week (stuck here)
Previous and next week button, to display previous and next week data (cant do anything here)
I am kinda of stuck while playing with the "date" thing. Can an...
In php i can get today date/day by using : $today = date('D, Y-m-d');
If today is wednesday 8 july, i want to display data from 6 - 11 July (9, 10 and 11 will be blank). How do I do that?
Now my system is like, today is 8 July, i will display 2 - 8 july, but start on wednesday. Not very like this way. I prefer, start on Monday to sunda...
I'm currently trying to optimize a MYSQL statement that is taking quite some time. The table this is running on is 600k+ and the query is taking over 10 seconds.
SELECT DATE_FORMAT( timestamp, '%Y-%m-%d' ) AS date, COUNT( DISTINCT (
email
) ) AS count
FROM log
WHERE timestamp > '2009-02-23'
AND timestamp < '2020-01-01'
AND TYPE = 'play...
I have a Drupal site on a shared web host, and it's getting a lot of connection errors. It's the first time I have seen so many connection timeout errors on a server. I'm thinking it's something in the configuration settings. Non-drupal parts of the site are not giving as many connection errors.
Since this hosting provider doesn't give...
Hi,
I have a table of items. item has id, score 1, score 2
I want to select 12 known items (using WHERE id IN (....)) and order them by a score that is the sum of score1 and score2's ranks. rank is the location of the score if the 12 items were ordered by it.
How can I do this in mysql?
Edit:
After 4 answers I see that the solution ...
Table has two columns:
CREATE TABLE items (
k INT auto_increment PRIMARY KEY,
val INT UNSIGNED
) ENGINE=MyISAM;
I put four items in the table:
INSERT INTO items (val) VALUES (12),(23),(45),(56);
Now if I do:
EXPLAIN SELECT * FROM items ORDER BY k;
I get the dreaded "using filesort". What's going on? According to this p...
Hello,
I am not sure if the is a duplicate post. But I have a plugin (js + forms + html + php) which can be added to various sites. These sites may have different encoding say ISO-8859-1,ISO-8859-9, utf8 etc. I cannot control their encoding of the html or anything.
I am wondering what is the best way to make my php + js + html + forms...
I need to exclude a product line from a database so I do pline != prodctline but certain products in that product line I do not want to be excluded.
For instance:
here is simlplistic version of my database:
partname, pline, option (3 columns)
i want to exclude all results from a certain product line unless they have X option value.
s...
I have a question regarding using Prepared Statements with JBoss and MySQL.
DataSource is configured on JBoss side. Here is the config file:
x
jdbc:mysql://x
com.mysql.jdbc.Driver
x
x
10
20
5000
5
org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
org.jboss.resource.adapter....
Currently working on a project that is centered around a medical nomenclature known as SNOMED. At the heart of snomed is are three relational datasets that are 350,000, 1.1 mil, and 1.3 mil records in length. We want to be able to quickly query this dataset for the data entry portion where we would like to have some shape or form of auto...
I have a PDF file on a local machine. I want to upload this file into a BINARY BLOB on a SQL database. Other approaches mentioned here [http://stackoverflow.com/questions/17/binary-data-in-mysql] all use PHP. I want a simple clean way to upload this PDF file on the Linux command line. Unfortunately, I do not have access to the remote fil...
Hello. I have three files: one called sql.php witch has a class db that I use to ease the get results operation from MySQL; one called session.class.php that has class session (extending class db) witch I use to make my basic operations as functions... like check_login function witch I use to check if user is logged in; and another one c...
Hi
I would really appreciate it if some of you could help optimize my tables, as they currently take extremely long to execute because of the following issues:
Main table:
game {
game_id [PRIMARY KEY]
*team_id
*stadium_id
home_score
opponent_score
date
tour
half_home_score
half_opp_score
attendance
ref...
Hi,
I want to combine three tables - date, lead and click - in a query.
The tables looks like this:
date:
|date|
lead:
id|time|commission
click:
id|time|commission
The table date is just storing dates and is used when getting dates with no click or lead.
So if we have the following data in the tables:
date:
2009-06-01
200...