I have a GridView which I bind at runtime to a dataset via a query. I handle the pagination using the PageIndexChanging and PageIndexChanged events to set the GridView's PageIndex property on postback from the pager. While this functions correctly, the problem is the performance with >7800 rows in this table. It has to return the entire ...
Hello,
I am working with a script for resizing images. I seem to be getting an error:
Error: no image was specified
Probably because of this code in the script(image.php):
if (!isset($_GET['image']))
{
header('HTTP/1.1 400 Bad Request');
echo 'Error: no image was specified';
exit();
}
Here is what I...
I have 2 tables items and item_relations
items has 4 columns row_id(primary key), story_id, field1 and field2
item_relation stores the relation between each rows in items table it has 2 columns parent_story_id and child_story_id. Both columns store story_id's of rows from items.
A parent item can have many child items and a Child can ...
What I ended up doing was taking two SQL queries and using the array_intersect() in PHP to filter out the results:
$sql1 = 'SELECT z.*, u.username, u.user_colour, u.username_clean, u.user_avatar, u.user_avatar_type
FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u
WHERE (( z.user_id = ' . $user->data['user_id'] . '
AND z...
How do I set the name of a primary key when creating a table?
For example here I'm trying to create a primary key with the name 'id', but this is invalid SQL. Can you tell me the correct way to do this?
CREATE TABLE IF NOT EXISTS `default_test`
(
`default_test`.`id` SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY `id`,
`default_te...
I have a table with categories:
ID Category
"1","Baking"
"3","Family"
"4","Entertaining"
"5","Children"
"6","Desserts"
Now I would like to order the result of the select statement to
ID Category
"4","Entertaining"
"3","Family"
"1","Baking"
"5","Children"
"6","Desserts"
for example. In MySQL, you'd do ...
Ok, let's say we have bank_account table. There is a row called money. It has 2,000 value. And we have two persons trying to withdraw that money, let's suppose they can do it. So, is it possible that they would do it at the same time? For example. there is a made-up code:
$all_money = get_value('money', 'bank_account); //lets suppose t...
I am converting dates and times into timestamps using PHP before they are inserted into my MySQL database.
My problem is that when i use PHP's strtotime function the output timestamp is -1 hour behind my actual time.
For example, considering todays date: 07/21/2010. When i use php code like:
<?php
$my_timestamp = strtotime("07/21/201...
I'm running a number of queries that merge constantly-changing data into a master table and one of the queries (below) seems to be running quite slowly.
The set up is as follows: products table and products_temp table have identical structures. New data goes into the products_temp table, then I run queries similar to the one below to me...
I use a local Apache server for many things, but I never really had a use for MySql. I recently decided to keep a local copy of Wordpress, so I installed MySql.
I tried to install PHPMYADMIN, but every time I tried to log on I got a blank screen. I tried with good and bad credentials and even the CONFIG mode. I even did the same thing w...
I call this function on top of every page.
How would I do so it removes expired bans also? If current time() is more than expire field.
Would really appricate help.
bans
id
ip
expire
(if expire is NULL its permanent)
function
function check_bans()
{
$user_ip = $_SERVER['REMOTE_ADDR'];
// Se if users ip is banned
$query = mysql_q...
I'm trying a subquery in MySQL using max(), and I keep running into an error. The gist of the query is below (though I've changed the field names).
select table1.field1, table1.field2, table2.field3, table2.field4, table3.field5,
(select max(age)
from age_table
where age_table.person = table2.person)
from...
This may be a stupid question but is it possible to store a count query in a field in a table such that when the result of the count changes the result will update itself?
Thread(ThreadID,NumMessages)
Message(MessageID,ThreadID,MessageText,PreviousMessage)
I want to update the Thread.NumMessages field any time a message with the c...
Hello,
I have a MySQL database with words containing accents in Spanish (áéíóú). I'd like to know if there's any way to do a diacritic insensitive search. For instance, if I search for "lapiz" (without accent), i'd like to get results containing the word "lápiz" from my db. The way I'm currently doing the query is as follows:
$result =...
I've seen a lot of posts about switching from php to Django but none have covered this. I have a website that is built entirely in php (php 5, mysql, and apache2). This site is used only for collecting data from users. Now I need to make a second half of the site to display the data. This will be step 2 of 5 in the overall plan, and I'd ...
I update a table, but my query clear all columms, can I roll back this updates?
...
Hi All,
We have a query(mysql) which returns data in the following format of alphabets followed by digits followed by alphabets like --
text1 12.12 mg text2
Now the issue is , i need to write a script in php which gives all the data starting from the 1st digit.so the result should be something like
12.12 mg text2
I am not sure how t...
I'm making a site in ASP.NET MVC 2 using C#. I designed a database with a bunch of tables that have many to many relationships, similar to the following:
GrandParent - many to many - Parent
and
Parent - many to many - Child
I used the Entity Framework to make all of the entities class and am now working on a function in a repositor...
I have two tables, one that stores serial number uut_build, and another for measurements that belong to the serial numbers measure_list, I'm trying to get the count of records in measure_list that belongs to a unique serial number.
Query #1
select id, uut_sn from uut_build where uut_sn like 'A%';
Query #2
select count(*) from measur...
I'm quite a beginner at database design. I have two problems that I'd like to solve using a database, but am not sure how to deal with an unknown number of fields.
Here are the two types of data I'd like to store (they represent the same schema issue I think):
I want to store a bunch of coordinates for a map route. The proposed DB woul...