02-21-2010
I wonder in that case what my problem is...
I issue the following query in phpMyAdmin:
PHP Code:
SELECT venue, SUM( amount )
FROM IWD
WHERE venue = 'Foxy Hollow'
And get this result:
venue SUM(amount)
NULL NULL
If I take away the single quotes, I get an error:
PHP Code:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Hollow' at line 1
SELECT venue, SUM( amount )
FROM IWD
WHERE venue = Foxy Hollow
If I have entries without spaces (for example FoxyHollow) the query works like a charm..
I guess I could convert the names to replace blanks with underscores.. but I'd rather not. :/
Edit: Damn it, id Didn't work.. but, now I really don't understant this.. it worked yesterday.. I HAVE made some changes somewhere, dut damn me if I could remember what.. there IS something wrong with the query.. my apologies... now.. I just need to find out WHAT is wrong with my query.. :/
Last edited by noratx; 02-21-2010 at 06:14 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
MySQL on my server is down....
I figured out that the mysqld process isn't running. When I try to run it, it says it can't find mysql.sock
Any suggestions?
Here's what I can't do:
can't be root
don't have physical access (do stuff via SSH)
reinstall MySQL (need to keep the current MySQL... (8 Replies)
Discussion started by: _hp_
8 Replies
2. Solaris
Can anyone help me find and replace blank rows in a file with a numeric value (ie blankrow=someTxtOrNumValue), the file is over 500,000 rows long so it would need to be the quickest way as I'll need to do this for multiple files...I would be greatfull for any suggestions....thanks
sample file:... (2 Replies)
Discussion started by: Gerry405
2 Replies
3. Web Development
Hi all,
I was wondering if anyone knew a good/safe way to update a single column in a table that could contain upto 8 million rows...
simple command like:
UPDATE set blah=foo where bar=XXX;
I will be running this on tables being written to and tables that have already been created.
... (3 Replies)
Discussion started by: muay_tb
3 Replies
4. Shell Programming and Scripting
Hey all, I have a list in the format ;
variable length with spaces
more variable information
some more variable information
and I would like to transform that 'column' into rows ;
variable length with spaces more variable information some more variable information
Any... (8 Replies)
Discussion started by: TAPE
8 Replies
5. UNIX and Linux Applications
Hello,
Met a problem when I tried to insert rows to MySQL database from an old book that fits my learning level (MySQL and Perl for the Web, by Paul DuBois, 2001). First, under mysql console I created a database: webdb and the table: todo. Then I draft the perl-cgi script to have online page.... (0 Replies)
Discussion started by: yifangt
0 Replies
6. Programming
I feel stupid for asking this because it seems that MYSQL code isn't working the way that I think it should work.
Basically I wrote code like this:
select * from `Test_DC_Trailer` HAVING max(DR_RefKey);
Where the DR_RefKey is a unique numeric field that is auto iterated (like a primary key)... (7 Replies)
Discussion started by: Astrocloud
7 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
My requisite is to split a single column of phonemes seperated by spaces into multiple rows.
my input file is:
a
dh
u
th
a
qn
ch
A
v
U
r
k
my o/p should be like:
adhu a dh u (3 Replies)
Discussion started by: girlofgenuine
3 Replies
8. Shell Programming and Scripting
Hi, i want to create a table automatically based on another table (sms_key).
For example;
If user create a new row with sms_keyword field: IRC then a table created automatically (with some field on it, like: name, ph_number, messages).
select * from sms_key;
+-------------+
|... (1 Reply)
Discussion started by: jazzyzha
1 Replies
9. Shell Programming and Scripting
Dear community,
I have to split string in table and list all values. I'll skip the code and jump directly to mysql query.
This is the table:
category title
======= =======
7,3 title 1
1,3 title 2
1,2,3 title 3
Now, what I need is split category into single... (2 Replies)
Discussion started by: Lord Spectre
2 Replies
10. UNIX for Dummies Questions & Answers
Hello,
some member created 27000 posts in wrong section (lol :D) so i need to edit all his entries to get new section ID.
SELECT * FROM `phpbb_topics` WHERE `topic_first_poster_name` LIKE "%ozerway%";
this will select all his topics...
the column with forum id is named "forum_id" and... (3 Replies)
Discussion started by: postcd
3 Replies
LEARN ABOUT PHP
mysqlnd_memcache_set
MYSQLND_MEMCACHE_SET(3) 1 MYSQLND_MEMCACHE_SET(3)
mysqlnd_memcache_set - Associate a MySQL connection with a Memcache connection
SYNOPSIS
bool mysqlnd_memcache_set (mixed $mysql_connection, [Memcached $memcache_connection], [string $pattern], [callback $callback])
DESCRIPTION
Associate $mysql_connection with $memcache_connection using $pattern as a PCRE regular expression, and $callback as a notification call-
back or to unset the association of $mysql_connection.
While associating a MySQL connection with a Memcache connection, this function will query the MySQL Server for its configuration. It will
automatically detect whether the server is configured to use the InnoDB Memcache Daemon Plugin or MySQL Cluster NDB Memcache support. It
will also query the server to automatically identify exported tables and other configuration options. The results of this automatic config-
uration can be retrieved using mysqlnd_memcache_get_config(3).
PARAMETERS
o $mysql_connection
- A handle to a MySQL Server using one of the MySQL API extensions for PHP, which are PDO_MYSQL, mysqli or ext/mysql.
o $memcache_connection
- A Memcached instance with a connection to the MySQL Memcache Daemon plugin. If this parameter is omitted, then $mysql_connection
will be unassociated from any memcache connection. And if a previous association exists, then it will be replaced.
o $pattern
- A regular expression in Perl Compatible Regular Expression syntax used to identify potential Memcache-queries. The query should
have three sub patterns. The first subpattern contains the requested field list, the second the name of the ID column from the
query and the third the requested value. If this parameter is omitted or os set to NULL, then a default pattern will be used.
o $callback
- A callback which will be used whenever a query is being sent to MySQL. The callback will receive a single boolean parameter
telling if a query was sent via Memcache.
RETURN VALUES
TRUE if the association or disassociation is successful, otherwise FALSE if there is an error.
EXAMPLES
Example #1
mysqlnd_memcache_set(3) example with var_dump(3) as a simple debugging callback.
<?php
$mysqli = new mysqli("host", "user", "passwd", "database");
$memc = new Memcached();
$memc->addServer("host", 11211);
mysqlnd_memcache_set($mysqli, $memc, NULL, 'var_dump');
/* This query will be intercepted and executed via Memcache protocol */
echo "Sending query for id via Memcache: ";
$mysqli->query("SELECT f1, f2, f3 FROM test WHERE id = 1");
/* f1 is not configured as valid key field, this won't be sent via Memcache */
echo "Sending query for f1 via Memcache: ";
$mysqli->query("SELECT id FROM test WHERE f1 = 1");
mysqlnd_memcache_set($mysqli);
/* Now the regular MySQL protocol will be used */
echo "var_dump won't be invoked: ";
$mysqli->query("SELECT f1, f2, f3 WHERE id = 1");
?>
The above example will output:
Sending query for id via Memcache: bool(true)
Sending query for f1 via Memcache: bool(false)
var_dump won't be invoked:
SEE ALSO
mysqlnd_memcache_get_config(3).
PHP Documentation Group MYSQLND_MEMCACHE_SET(3)