I have two web servers. Server 'A' and server 'B'. Both are exact duplicate of the other and are connected to a load-balancer for serving clients.
I have a tasks (cronjob) that is executed at every hour, every day. This task is currently running only on server 'A'. The problem is that this tasks is really important and if server 'A' cra...
I'm interested to know if a union is better than running multiple queries.
If so, are there times that multiple queries would be faster or preferred for other reasons?
...
I have a table svn1:
id | date | startdate
23 2002-12-04 2000-11-11
23 2004-08-19 2005-09-10
23 2002-09-09 2004-08-23
select id,startdate from svn1 where startdate>=(select max(date) from svn1 where id=svn1.id);
Now the problem is how do I let know the subquery to match id with the id in the outer query. Obviously id=svn...
Is it possible with phpmyadmin to export a dump of selected tables, with only a subset of datas? For example the first 50 records?
...
can some assist me with my code, everything looks correct checked each line at least 10 times. I've even hardcode in the user/pass for the query and still nothing.
<?php
include "database.php";
$sql = "SELECT UserName, Password, Language, Editor FROM admin_login WHERE UserName='".$_POST['username']."' AND Password='".$_POST['pwd']."'";...
Hiya,
I'm trying to work out the following query:
SELECT did_numbers.did_dialstring,
netareas.netarea_name,
did_numbers.did_size,
CASE WHEN (reseller_id < 1) IS NULL THEN 'F'
ELSE 'T'
END as reseller,
COUNT(*) AS aantal
FROM did_numbers
...
I have this problem:
Warning: #1265 Data truncated for column
I got a form with a value coming from a text field : price.
When I put a decimal like : 45,56 ( French format)
My MySQL column type is a float.
Could someone help please ?
...
Hi,
I have a mysql query that brings in a list of results, say 10, each with its own 'last edited' date, and was wondering if it was possible to display/echo/print ONLY the most recent of these dates using php?
Now I know I could do this with a mysql query, but I need to display all of the available results, but only 1 date, (the most ...
I want to be able to keep a log of every sql statment that edits a specific table, and I think the best way would be with a trigger. However, I don't know how to get the statement that triggers the trigger.
For example if I run:
$sql = "INSERT INTO foo (col_1) VALUES ('bar');"
I want to be able to craft an insert statement like:
...
I'm storing IPv4 addresses in a "int unsigned" column type with inet_aton. [Am I doing this right? And is using "unsigned" necessary?] This particular column is indexed as well. Since there will be millions of rows and multiple rows containing the same IP throughout the entire table what will be the fastest way to search for these rows?
...
I have a while loop of a mysql call but I also am trying to run another mysql query inside of the while loop but it is only doing it once. I can not figure it out.
Here is my code:
$sql = "SELECT * FROM widget_layout WHERE module_id=".mysql_real_escape_string($id)." AND state='".mysql_real_escape_string($page)."' AND position=".mysql_r...
Is there any way to have MySQL order results by how close they 'sound' to a search term?
I'm trying to order fields that contain user input of city names. Variations and misspellings exist, and I'd like to show the 'closest' matches at the top.
I know soundex may not be the best algorithm for this, but if it (or another method) could b...
I'm trying to filter a relationship table down to get a subset of the table where two conditions are met (ie: I want all of the id's of the entries who's color_ids are 1 or 2). It's a beefy table, so I'm trying to optimize as much as possible.
I was wondering if anyone could explain my finding in this case:
Why is
SELECT DISTINCT a.id...
Hi, I need to reset a root password for one of my mysqld processes. I know in mysql, you can use mysqld_safe with the skip grant tables option, but what do you do when you have multiple mysql processes and want to reset their root user passwords? I can't use this option with mysqld_multi.
thanks,
...
If I have a table of random values in a sql table, how can I export and display them as a raking rather than the absolute value... for example.. if the three values are 30 85 and 90 how do i get 30 do display as 1 or 1st, 85 as 2 or 2nd etc
...
i am planning to get some Data Entry done for the records of Restaurant info which i later want to upload to MySQL table.
Is there some kinda rules i need to follow because i read some place that we have to mention some kinda delimiter like , ; etc. not sure how to do that in Excel.
Secondly can i use Google Forms which stores question...
PHP:
function generate_uid() {
$uid = mt_rand();
$sql = "SELECT user_id
FROM user_registration";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
$result = mysql_query($sql);
$availability = TRUE;
while($row = mysql_fetch_array($result)) {
if($row['user_id'] == $u...
I'm trying to do some simple manipulations with variables in MySQL 5.0 but I can't quite get it to work. I've seen many (very!) different syntaxen for DECLARE/SET, I'm not sure why... in any case I'm presumably confusing them/picking the wrong one/mixing them.
Here's a minimal fragment that fails:
DECLARE FOO varchar(7);
DECLARE oldFO...
My Schema
I have the following tables
table notes/example values
------------------------------------------------
users (
id
email # "[email protected]"
)
games (
id
name # "Space Invaders", "Asteroids", "Centipede"
)
players (
...
I have a password being passed from my iPhone app to the database via a php script, user.php.
The variable $pass is populated by the following:
$pass = str_replace("'", "", $_REQUEST['pass']);
How can I encrypt this before it's inserted into my database? I've read a little about the different techniques, but looking for the best way ...