Hi,
which is more efficient (when managing over 100K records):
A. Mysql
SELECT * FROM user ORDER BY RAND();
of course, after that i would already have all the fields from that record.
B. PHP
use memcached to have $cache_array hold all the data from "SELECT id_user FROM user ORDER BY id_user" for 1 hour or so... and then:
$id = ar...
I have 3 tables holding products for a restaurant. Products that reside in the bar, food and ingredients.
I use php and mysql. I have another table that holds information about the orders that have been made so far. There are 2 fields, the most important ones, that hold information about the id of the product and the type (from the bar,...
Is it possible to extract a script from an MySQL database to create a copy of the tables on another MySQL database which is located on a remote server?
...
How can I serach word with "&" using mysql full text search ?
There are words string, like "Marks & Spencer", "at&t" in my tables , serach "at&t", but can't find it on the database using mysql full text search
Any ways to serach word with "&"?
...
I am facing quite a specific optimization problem.
I currently have 4 normalized tables of data.
Every second, possibly thousands of users will pull down up-to-date info from these tables using AJAX.
The thing is that I can predict relatively easily which subset of data they need... The most recent 100 or so entries in those 4 normali...
I have 2 tables that their rows have one on one relation..
For you to understand the situation, suppose there is one table with user informations
and there is another table that contains a very specific informations and each user can only link to one these specific kind of informations ( suppose second table as characters )
And that cha...
i have answers table ( ans_id , question_id , ans_date)
and answers_votes table (vote_id , user_id , ans_id , vote = 1 or -1)
i want select from answers that have the big sum(vote) of vote that posted today this mean have today date in ans_date
...
Am trying to return the sum of each day of a week in mysql but it returns nothing despite having values for the 3rd Week of March 2010
SELECT SUM(expense_details_amount) AS total
FROM expense_details
WHERE YEAR(expense_details_date) = '2010'
AND MONTH(expense_details_date) = '03'
AND WEEK(expense_details_date) ...
How to create a relation between two tables using PHPMyAdmin?
...
I've read various sources but I'm unsure how to implement them into my code. I was wondering if somebody could give me a quick hand with it? Once I've been shown how to do it once in my code I'll be able to pick it up I think! This is from an AJAX autocomplete I found on the net, although I saw something to do with it being vulnerable to...
I am running a sql in PHP query that is dieing with the mysql_error() of
Unknown column '' in 'field list'
The query:
SELECT `standard` AS fee FROM `corporation_state_fee` WHERE `stateid` = '8' LIMIT 1
when I run the query in PHPmyadmin, it return the information without flagging the error
EDIT:
I apologize for not posting enough...
probably missing something simple:
<?php
$con=mysql_connect('localhost','xxx','xxx');
$db=mysql_select_db('xxx');
$sql = mysql_query("SHOW TABLE STATUS WHERE `name`=\"my_table\"");
$foo=mysql_fetch_array($sql);
return $foo['Update_time'];
// returns 2010-03-31 16:51:06
?>
how do i format this. I tried using
date('l jS F Y @ H:i...
Hey guys quick question, I have a query that I want to count all entries it finds, and select all so when I use while($row=mysql_fetch_assoc($query)){ it will list all entries. The problem I am encountering is that while, all the entries are successfully counted and the right number is listed, only the latest entry is select and listed w...
I'm not sure if this will make sense, but I'll give it a shot.
My hard drive went down and I had to reinstall the os along with all my webserver configuration,etc. I kept a backup of the mysql database, but it doesn't contain all the tables...I added a couple tables after my last backup.
I have access to the hard drive and the direc...
I am trying to run a website locally in Windows 7 under IIS 7. I have the AppPool configured to use "Classic" mode, but connecting to a MySQL DB that requires SSL fails. If I change the identity to my user account it works perfectly. It fails when using the default "ApplicationPoolIdentity" account. Is there something I'm missing somewhe...
for example i use following command to find a record
SELECT `users`.`mail`
FROM `users`
WHERE `users`.`uid` = %s
if found an match, then i should like to delete this record, and update in the same query an another table. i can solve this with 'joins' ?
...
Hi,
In a php/mysql application where people can registre, is it a good idea to strtolower the username then store in the database in order to not have problems in the future? because people are using DiFfeReNt cases and i'm afraid that will make conflict in some queries.
Thanks
...
NOTE: EDITED
The real-world situation is a series of events that each have two or more participants (like sports teams, though there can be more than two in an event), only one of which is the host of the event. There is an Event db table for each unique event and a Participant db table with unique participants. They are joined together...
I am trying to use this MySQL query:
SET @a:=0; UPDATE tbl SET sortId=@a:=@a+1 ORDER BY sortId;
Unfortunately I get this error:
"Parameter '@a' must be defined"
Is it possible to batch commands into 1 query like this, or do I need to create a stored procedure for this?
...
Hi,
I have table with an auto-increment field, but I need to transfer the table to another table on another database. Will the value of field 1 be 1, that of field 2 be 2, etc?
Also in case the database get corrupted and I need to restore the data, will the auto-increment effect in some way? will the value change? (eg if the first row,...