This is really just a PHP question, I think.
Are MySQL and Apache running on the same machine?
What version of MySQL are you running?
Typically, you need a PHP mysql_connect() call including the MySQL
host, username, and password. You only list the host above.
With a default installation of MySQ
Laura:
Perhaps the "-" is acting like a Boolean operator. What if you put
double quotes around your search phrase:
SELECT * FROM metadata WHERE MATCH( type ) AGAINST ( '+"XY-11443"' IN
BOOLEAN MODE );
Wes
On Wed, 29 Sep 2004 13:22:54 -0400, Laura Scott <[EMAIL PROTECTED]> wrote:
>
>
> Hello,
Use COUNT():
SELECT COUNT( id ) FROM test WHERE LEFT( id, 5 ) = '12345' GROUP BY value;
Wes
On Tue, 21 Sep 2004 00:24:33 +0200, Alexander Newald
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> I like to get the number of lines returned by a select ... group by query:
>
> Example:
>
> SELECT id FROM
Hi:
I was wondering if there is any performance-related reason to use a
unique index versus a standard index? Is the only benefit of a unique
index that it will prevent duplicate values from being inserted into a
table unless explicitly allowed?
I have a column, colA, that I know contains only un
Robb:
http://dev.mysql.com/doc/mysql/en/JOIN.html
I am assuming all the information you need is student name + city
name. SELECT * FROM StudentTable AS s, CityTable AS c WHERE s.CityID =
c.CityID
Wes
On Wed, 8 Sep 2004 19:55:29 -0500, Robb Kerr
<[EMAIL PROTECTED]> wrote:
> Trying to get my mind
Christian:
Change your readme and hostname columns to BLOB and use the
LOAD_FILE() function to add your record.
INSERT INTO test NULL, LOAD_FILE( '/path/to/readme/file' ), LOAD_FILE(
'/path/to/hostname/file');
More on the LOAD_FILE() function:
http://dev.mysql.com/doc/mysql/en/String_functions.ht
Assuming there are no parts of a name that include more than one word
(e.g., "Mary Jo" being someone's first name), an easy way would be to
use SUBSTRING_INDEX.
First Name = SUBSTRING_INDEX( namefield, ' ', 1 );
Middle Name = SUBSTRING_INDEX( SUBSTRING_INDEX( namefield, ' ', 2 ), ' ', -1 );
Last N
It might just be that your connect line isn't working properly. Try
this form instead:
mysql -u root -h MyLinuxSystem -p
You want to connect as user "root" to host "MyLinuxSystem" using a
password for which you will be prompted.
If that doesn't wok, you need to make sure that on your server, on
y
I don't think so. I think your current method of either storing it in
the query or with a boolean field is your best bet. What I've seen
done in the past is that records get marked with a user level and
there is either one or a group of users who are allowed to delete or
modify those otherwise per
I have a common update that I need to run that is a bottleneck in a
lot of the reports that are being requested. If anybody else has dealt
with a similar situation but with more success, any tips would be
appreciated.
Basically, I have a one-to-many relationship and I want to update
every record i
Jose:
It looks like you can log in to the mysql client as root. Do you have
permission to change the password once you're logged in?
[EMAIL PROTECTED] jusoz]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor...
mysql>USE mysql;
Database changed.
mysql>UPDATE user SET Password = PAS
d these values to plot a chart. Please let me know?
-----Original Message-
From: Wesley Furgiuele [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 18, 2004 11:36 AM
To: Viswanatha Rao
Cc: [EMAIL PROTECTED] List
Subject: Re: select rows by compare on datetime column
Vishwa:
Sorry -- I used a spe
;
Wes
On Aug 18, 2004, at 12:24 PM, Wesley Furgiuele wrote:
Does the date matter, or only the time?
If date matters (you want to find all records between 2004-06-01
10:00:00 AND 2004-06-03 18:00:00):
SELECT columns FROM table WHERE start_time >= '2004-06-01 10:00:00'
AND end_time
Does the date matter, or only the time?
If date matters (you want to find all records between 2004-06-01
10:00:00 AND 2004-06-03 18:00:00):
SELECT columns FROM table WHERE start_time >= '2004-06-01 10:00:00' AND
end_time <= '2004-06-03 18:00:00'
If only time matters( you want to find all records
What error are you getting? My problem when moving to 4.1 was
forgetting that I was using an older MySQL client.
I'm not positive, but I think that in order to connect to MySQL 4.1
with PHP you need to use the mysqli functions, not mysql, and mysqli
requires PHP 5.
If you want to keep using
I tend to use LOAD_FILE(), but your file has to be on the server and
readable by MySQL ("INSERT INTO table ( field1, field2 ) VALUES ( 'a',
LOAD_FILE( 'filepath' )" ). If you're using a programming language
rather than just the MySQL client, you can also read the file into a
variable and insert
Try
SET PASSWORD FOR 'root'@'localhost' = PASSWORD( 'newpwd' );
SET PASSWORD FOR 'root'@'%' = PASSWORD( 'newpwd' );
There was no username in your SET PASSWORD command.
Wes
On Jul 30, 2004, at 4:38 PM, aspsa wrote:
Per the MySQL documentation I used the following commands to establish
login
both at
Keith:
I don't know if it's the same problem, but I recently had issues where
I had a similar setup with only two MySQL servers, one 4.0.20, the
other 4.1.3, same usernames/passwords on each.
My solution, and I don't remember where in the manual I saw this
(possibly the FAQ), was to do an updat
Using MySQL 4.0.20, I need to extract just the numeric portion of a
string in a field and move it to another field in the same table, but
I'd only like to do this if the value actually starts with a number.
So, what I'm looking to accomplish is:
UPDATE table SET field2 = VOODOO( field1 )
The fi
Danny:
What if you just pad the string, does it work then?
str_to_date( LPAD( '901', 4, '0' ), '%k%i' )
Wes
On Jul 22, 2004, at 2:05 PM, [EMAIL PROTECTED] wrote:
I have a "time" field formatted as hhmm however the hours field does
not
add leading zeros. eg 09:01 is simple 901.
I want to get
"OR"
From the manual:
"Every correct word in the collection and in the query is weighted
according to its significance in the collection or query."
http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html
If you want "AND", look at the boolean full-text searches format:
http://dev.mysql.com/doc/mys
the whole string. Sorry for
any confusion.
Wes
On Jul 21, 2004, at 1:01 AM, Wesley Furgiuele wrote:
To get "http://www.google.com/"; out of the URL, you can do this:
LEFT( referer, LENGTH( SUBSTRING_INDEX( referer, '/', 3 ) ) + 1 )
If you don't care about the t
got
ignored, in case you need to document that there was an attempt to
insert the data.
Wes
On Jul 21, 2004, at 12:58 AM, Scott Haneda wrote:
on 7/20/04 9:44 PM, Wesley Furgiuele at [EMAIL PROTECTED] wrote:
First off, the unique index is something you define for the table
once.
Being unique, yo
To get "http://www.google.com/"; out of the URL, you can do this:
LEFT( referer, LENGTH( SUBSTRING_INDEX( referer, '/', 3 ) ) + 1 )
If you don't care about the trailing slash, you can use just the
SUBSTRING_INDEX() portion:
SUBSTRING_INDEX( referer, '/', 3 )
Using the LENGTH() function just help
, at 10:36 PM, Scott Haneda wrote:
on 7/20/04 4:10 PM, Wesley Furgiuele at [EMAIL PROTECTED] wrote:
Rather than make the email address column unique, since you want to
allow multiple email address instances, you can make a unique index
based on email_address+group. Wouldn't that help, or is that st
Scott:
Sorry, should have included it...
http://dev.mysql.com/doc/mysql/en/CREATE_INDEX.html
The basic syntax you're looking to use is
ALTER TABLE tablename ADD UNIQUE `index_name` ( email_address, group )
Wes
On Jul 20, 2004, at 7:45 PM, Scott Haneda wrote:
on 7/20/04 4:10 PM, Wesley Furgiue
Scott:
Rather than make the email address column unique, since you want to
allow multiple email address instances, you can make a unique index
based on email_address+group. Wouldn't that help, or is that still too
simple for your situation?
Regarding temporary tables, from the MySQL manual:
Fro
David:
I believe you mentioned it in a previous thread, but I forget what kind
of field NameMam is. It's important because you might be required to
give that key part in your index a length.
Also, I'm assuming that this index is on a unique identifier field. If
it's not, then just substitute th
Someone else might be able to provide a SQL query for formatting with
commas, but otherwise just let PHP do all your formatting.
PHP's number_format() function is probably your best bet. You might
want to look at PHP's money_format() function also, since it might save
you some time depending on
I think one way to solve it would be to move your data to a new copy of
your table. Assuming record_ref and keyword are separate fields...
CREATE TABLE newtable SELECT * FROM oldtable GROUP BY CONCAT(
record_ref, keyword );
Wes
On Jul 16, 2004, at 7:08 PM, L a n a wrote:
Hello,
I'm trying to s
JS:
When I use DATE_FORMAT(), if I have a space character between
DATE_FORMAT and the ( I get an error. Try writing it like:
SELECT DATE_FORMAT( "20040601123456", '%Y-%m-%d' );
MySQL v4.1.2-alpha-standard
Mac OS X
Wes
On Jul 14, 2004, at 12:20 PM, J S wrote:
Thanks for your help. I would like to
If you have 4.1.1 or greater, you can use GET_FORMAT( timestamp, 'ISO'
).
Otherwise, I think if you just use DATE_FORMAT( timestamp, '%Y-%m-%d
%H:%i ) you will get weird values if your timestamp field doesn't
include seconds. So, either alter your field to be CONCAT( timestamp,
'00' ), or, as
CTED]
Justin Credible [EMAIL PROTECTED] --DUPE--
Case differences between the records could also cause
dupes. If case differences are causing it then do
select lower(first), lower(last), lower(email)
...
group by lower(first), lower(last), lower(email)
--- Wesley Furgiuele <[EMAIL PROTECTED]>
What type of field is the email field?
Wes
On Jul 13, 2004, at 11:04 AM, Aaron Wolski wrote:
Hey all,
Got this query:
SELECT first,last,email FROM CustomerTable AS t1,
OrderTable AS t2, CartTable AS t3 WHERE t2.cart_id=t3.cart_id
AND t1.id=t2.customer_index AND t3.submitted='1' AND
t3.product_index
SELECT CONCAT( UPPER( LEFT( first, 1 ) ), LOWER( RIGHT( first, LENGTH(
first ) - 1 ) ) ) AS `first` FROM table
On Jul 13, 2004, at 12:51 PM, Aaron Wolski wrote:
Hey guys,
I have a column in a table called 'first'.
Currently all records are upper case. Is it possible for me to do a
select statemen
Gary:
Am I looking at PHP's "date()" function? You are taking a timestamp
from a MySQL table and wanting to convert it into a US format. Is the
timestamp stored in your MySQL table a Unix timestamp or a MySQL
timestamp?
It's important to note that you can't take a MySQL timestamp and use
PHP's
Possibly because, if there is no typo, your table's name field is:
dr. smith1 (note the period after "dr")
But your query is looking for
dr smith1
Does that fix it for you?
Wes
On Jul 5, 2004, at 4:18 PM, bruce wrote:
hi...
a basic select question/issue that should work
mysql> select * from ins
Bruce:
The problem is that you have universityTBL listed twice in your list of
tables. Here is your statement, with numbers for each of the sources.
SELECT schoolTBL.name, universityTBL.name
FROM (1) universityTBL, (2) schoolTBL
LEFT JOIN (3) universityTBL ON schoolTBL.universityID =
university
After you finish installing MySQL, you need to start it up before
connecting to it -- the installation won't do that automatically for
you.
http://dev.mysql.com/doc/mysql/en/Unix_post-installation.html
That manual page will give you the right commands. Basically, after
installation, run the mys
I can help easily enough on formatting the dates...
The DATE_FORMAT( date, format ) function is what you want:
DATE_FORMAT( date, "%m/%d/%Y" )
Wes
On Jun 30, 2004, at 9:40 PM, Mike Koponick wrote:
Hello all,
I would like to be able to select the certain dates within my script.
select created_date,
Lana:
The easiest thing would be if your field always contained the same
number of comma-separated strings. Then you could just do something
like a SUBSTRING_INDEX() function to break out the field into separate
values. But, assuming your field does not always contain the same
number of str
Someone else hopefully has something more efficient:
UPDATE table SET field = CONCAT( UPPER( LEFT( field, 1 ) ), LOWER(
SUBSTRING( field, 2 ) ) )
Wes
On Jun 30, 2004, at 12:46 PM, Aaron Wolski wrote:
Hi Guys,
I'm trying to figure out of this is possible. I know I could do it in
PHP but I am deali
zzapper:
I could be reading it wrong, but it looks like you're looking for the
result of your REGEXP in a list. REGEXP returns only a 0 or 1, not the
expression resulting from performing a REGEXP.
Wes
On Jun 29, 2004, at 9:25 AM, zzapper wrote:
Hi,
select * from ytbl_development as t1
where (t1
Bob
My versions are Access 2000 and MySQL 4.0.20. Here's what I do.
When exporting my Access table, I choose the file type Text Files.
Then, on the next dialog box, make sure to click the Advanced button to
get to the formatting information. Change the date order to YMD and the
date delimiter to
ently I had included the hours/minutes/seconds roughly
corresponding to when I wrote the response.
Wes
On Jun 26, 2004, at 10:18 PM, David Blomstrom wrote:
--- Wesley Furgiuele <[EMAIL PROTECTED]> wrote:
Otherwise, you could use PHP's date formatting
functions as well
(assuming you are
David:
For number formatting, in your below example, use:
http://us2.php.net/manual/en/function.number-format.php
For date formatting, try grabbing the date from MySQL in the format you
want to use:
SELECT DATE_FORMAT( date_field, '%M %D, %Y' ) AS `Dates` FROM ...
and then just print $r['Dates']
Does anybody have any feedback, particularly problems, using CAST to
strip the trailing alpha characters from a string in order to convert
the string to an integer? Is there a better way to do it with MySQL?
(MySQL 4.0.20, Mac OS X 10.3)
Here's my situation:
TABLE_1
id CHAR( 8 )
TABLE_2
id INT(
I am guessing this is a pretty basic question...
There must be a better way for me to do this, but I'm still too new at this
to know what it is. I've gone through some JOIN tutorials and the
documentation, but I don't think I'm quite getting it.
(Using MySQL v3.23.38) I have three tables: my_cl
48 matches
Mail list logo