Re: Connection Help - Stupid Question, sorry to bother.

2006-08-13 Thread Chris

Chris W wrote:
By default MySQL uses port 3306 so you need to be sure that port is open 
on the server, and not blocked by a firewall.  You also need to be sure 
the user you are trying to login as can login remotely.  In the MySQL 
user data base, there is a column for host which is the host that user 
can login from.  If that host says localhost you can only login from the 
localhost.  If it says % you can login from any host.  Also note there 
can be more than one entry for each user all with a different host.  It 
is best to only set it up so you can login from a specific host, that 
makes it more difficult for a hacker to break in. If the user you are 
logging in as is set up just for localhost I would add a user and use 
the host you plan to login from if you can, other wise just change the 
host to % then you can login from anywhere.  Also if you do an update to 
the user table, using the sql update command, you also need to execute 
flush privileges for the changes to take effect.


The other thing is that mysql has to be set up to allow remote 
connections, it's not by default on some systems (eg debian).


Check the my.cnf and make sure there is no 'skip-networking'.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Connection Help - Stupid Question, sorry to bother.

2006-08-12 Thread Sana Farshidi

Hi,
Im sure this is a stupid problem but im a bit confused, and some assistance
would be greatly appreciated.

Im trying to assist with the maintenance/updating of a php site for a school
which uses mysql, and is allready up and running on a remote server.
I have the ftp username and password, and i can access the php/html side of
things no problems, but i want to connect to the mysql database on the
server, and as stupid as it sounds, i have no idea how to go about
connecting.
Ive used mysql before, not very efficiently, but never have had to set it
up, i was always told the program and connection details.

I downloaded a mysql program (enginsite MySql client) and tried to connect
but am not having any luck and have no idea what the port is supposed to
be...

the detail i have are: (of course ive undisclosed the username/passwords)

DOMAIN ACCOUNT DETAILS
Domain Name: www.mhmcindia.org

FTP DETAILS
Host Name / IP Address: 216.67.234.167 or ftp.mhmcindia.org
username: undisclosed
password: undisclosed

and the PHP connects through the script (on the remote server of course)
$host=localhost;
$username=undisclosed;
$password=undisclosed;
$db=undisclosed;

$link = mysql_connect($host, $username,$password)
   or die(Could not connect :  . mysql_error());

mysql_select_db($db) or die(Could not select database);

Is there anyway i can connect to the mysql database with these details? if
so how?

Im sorry for asking seemingly obvious questions, but some assistance would
be greatly appreciated.

Thanks,
Sana


Re: Connection Help - Stupid Question, sorry to bother.

2006-08-12 Thread Chris W
By default MySQL uses port 3306 so you need to be sure that port is open 
on the server, and not blocked by a firewall.  You also need to be sure 
the user you are trying to login as can login remotely.  In the MySQL 
user data base, there is a column for host which is the host that user 
can login from.  If that host says localhost you can only login from the 
localhost.  If it says % you can login from any host.  Also note there 
can be more than one entry for each user all with a different host.  It 
is best to only set it up so you can login from a specific host, that 
makes it more difficult for a hacker to break in. If the user you are 
logging in as is set up just for localhost I would add a user and use 
the host you plan to login from if you can, other wise just change the 
host to % then you can login from anywhere.  Also if you do an update to 
the user table, using the sql update command, you also need to execute 
flush privileges for the changes to take effect.


Sana Farshidi wrote:


Hi,
Im sure this is a stupid problem but im a bit confused, and some 
assistance

would be greatly appreciated.

Im trying to assist with the maintenance/updating of a php site for a 
school

which uses mysql, and is allready up and running on a remote server.
I have the ftp username and password, and i can access the php/html 
side of

things no problems, but i want to connect to the mysql database on the
server, and as stupid as it sounds, i have no idea how to go about
connecting.
Ive used mysql before, not very efficiently, but never have had to set it
up, i was always told the program and connection details.

I downloaded a mysql program (enginsite MySql client) and tried to 
connect

but am not having any luck and have no idea what the port is supposed to
be...

the detail i have are: (of course ive undisclosed the username/passwords)

DOMAIN ACCOUNT DETAILS
Domain Name: www.mhmcindia.org

FTP DETAILS
Host Name / IP Address: 216.67.234.167 or ftp.mhmcindia.org
username: undisclosed
password: undisclosed

and the PHP connects through the script (on the remote server of course)
$host=localhost;
$username=undisclosed;
$password=undisclosed;
$db=undisclosed;

$link = mysql_connect($host, $username,$password)
   or die(Could not connect :  . mysql_error());

mysql_select_db($db) or die(Could not select database);

Is there anyway i can connect to the mysql database with these 
details? if

so how?

Im sorry for asking seemingly obvious questions, but some assistance 
would

be greatly appreciated.

Thanks,
Sana




--
Chris W
KE5GIX

Gift Giving Made Easy
Get the gifts you want  
give the gifts they want
One stop wish list for any gift, 
from anywhere, for any occasion!

http://thewishzone.com


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Really stupid Question...

2003-08-01 Thread Ola Ogunneye
I am a Windows User and very used to the Dos Prompt. Can someone please
tell me what the Shell Prompt is?

What I am asking is the difference between a shell and a dos prompt
vis-a-vis mysql. 

Thank you.

Ola


RE: Really stupid Question...

2003-08-01 Thread Jack Coxen
A shell prompt is the Unix/Linux equivalent of the DOS prompt.  Since you
have the choice of several different operating systems shells to work in
(Bourne shell - sh, Korn shell - ksh, C shell - csh, Bourne Again shell -
bash (my favorite), etc) the command line prompts are generically referred
to as shell prompts.

Jack

-Original Message-
From: Ola Ogunneye [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 8:28 AM
To: [EMAIL PROTECTED]
Subject: Really stupid Question...


I am a Windows User and very used to the Dos Prompt. Can someone please
tell me what the Shell Prompt is?

What I am asking is the difference between a shell and a dos prompt
vis-a-vis mysql. 

Thank you.

Ola


Re: Really stupid Question...

2003-08-01 Thread Kevin J Citron
It's conceptually the same. Both allow you to enter in commands to either
execute code in batch or enter program names to be excuted. I'm not sure
about Win platforms. But, in the *.nix environments you have a choice
of different shells. And, also you can run things in the background and
a host of other capabilties. For your purposes, typing in mysql.
In theory it should be the same. But, I have not used mysql on a Win 
platform.

Ola Ogunneye wrote:

I am a Windows User and very used to the Dos Prompt. Can someone please
tell me what the Shell Prompt is?
What I am asking is the difference between a shell and a dos prompt
vis-a-vis mysql. 

Thank you.

Ola

 

--

Kevin J Citron
Sr. Object Imagineer
Optimized Objects, Inc.
EL Paso, Texas 79930
(915) 565-5777/566-2403


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: Really stupid Question...

2003-08-01 Thread Hayes, Scott
There is absolutely no difference. Shell prompt is used in *nix because of
the different shells you can work in but it all comes down to the same
thing.

Just type what is asked at the DOS prompt and it will work. The only part
that won't work is the file in the mysql/scripts directory as they are
scripts written to be used in a BASH shell in *nix. The perl programs will
work if you have perl installed on you PC.

Hope this helps,

Scott

 

-Original Message-
From: Ola Ogunneye [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 8:28 AM
To: [EMAIL PROTECTED]
Subject: Really stupid Question...


I am a Windows User and very used to the Dos Prompt. Can someone please
tell me what the Shell Prompt is?

What I am asking is the difference between a shell and a dos prompt
vis-a-vis mysql. 

Thank you.

Ola

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



probably a stupid question

2003-06-18 Thread Jonas Geiregat
Hey,
Here is what I want to do
I have 2tables
let's say table A and B for simplicity.
in table A I have column id
and in table B I have column A_id
I insert a new value into table A insert into a values(NULL)
Since id is auto_incremenet and the primary key it will have an auto value.
Now I want that the column A_id contains that id nr.
I could query for the biggest id in column A and insert that into B.
But are there better way's of doing something like this ?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: probably a stupid question

2003-06-18 Thread Twibell, Cory L
Check out LAST_INSERT_ID() in the manual


-Original Message-
From: Jonas Geiregat [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 18, 2003 12:26 PM
To: 'Mysql'
Subject: probably a stupid question


Hey,
Here is what I want to do
I have 2tables
let's say table A and B for simplicity.
in table A I have column id
and in table B I have column A_id

I insert a new value into table A insert into a values(NULL)
Since id is auto_incremenet and the primary key it will have an auto value.
Now I want that the column A_id contains that id nr.
I could query for the biggest id in column A and insert that into B.
But are there better way's of doing something like this ?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: probably a stupid question

2003-06-18 Thread Don Read

On 18-Jun-2003 Jonas Geiregat wrote:

snip 

 I insert a new value into table A insert into a values(NULL)
 Since id is auto_incremenet and the primary key it will have an auto
 value.
 Now I want that the column A_id contains that id nr.
 I could query for the biggest id in column A and insert that into B.
 But are there better way's of doing something like this ?
 

INSERT INTO tbl_B (A_id, ...)
 VALUES (LAST_INSERT_ID(), ...)

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: probably a stupid question

2003-06-18 Thread Andy Eastham
Jonas,

After the insert, execute

SELECT LAST_INSERT_ID();

This always gives the last auto increment value generated by your database
connection.

Andy

 -Original Message-
 From: Jonas Geiregat [mailto:[EMAIL PROTECTED]
 Sent: 18 June 2003 19:26
 To: 'Mysql'
 Subject: probably a stupid question


 Hey,
 Here is what I want to do
 I have 2tables
 let's say table A and B for simplicity.
 in table A I have column id
 and in table B I have column A_id

 I insert a new value into table A insert into a values(NULL)
 Since id is auto_incremenet and the primary key it will have an
 auto value.
 Now I want that the column A_id contains that id nr.
 I could query for the biggest id in column A and insert that into B.
 But are there better way's of doing something like this ?


 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
 http://lists.mysql.com/[EMAIL PROTECTED]





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: stupid question

2002-06-11 Thread Kenneth Hylton

I am assuming this is not a MySQL question since MySQL interacts with SQL
commands that are all in characters.

try using strstream.  You can poke just about anything into it and get a
string out.

If you must have a char*, then use the c_str() function of the string class.

The best implementation of this I've found is www.boost.org.

They have something called lexical_cast that works real cool.  It throws
exceptions if you feed it garbage.





-Original Message-
From: adelpfe [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 8:39 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: stupid question




  do you know any fonction that convert int to char*
  thantks

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: [PHP] Re: A stupid question...

2002-03-11 Thread Tim Ward

If you mean select by first letter then wild cards are what you want ...
http://www.mysql.com/doc/S/t/String_comparison_functions.html
http://www.mysql.com/doc/S/t/String_comparison_functions.html 

in your case SELECT ... WHERE lastname LIKE '$Letter%' ORDER BY lastname

... if you mean sort all records but don't sort past the first letter then
SELECT ..., LEFT(lastname, 1) AS lastname_first ... ORDER BY
lastname_first or you might even be able to do  ... ORDER BY
LEFT(lastname, 1) you'll have to experiment with that one.

Tim Ward
Internet chess www.chessish.com http://www.chessish.com 

--
From:  Chuck PUP Payne [SMTP:[EMAIL PROTECTED]]
Sent:  11 March 2002 02:59
To:  Cary; mysql lists.mysql.com
Cc:  PHP General
Subject:  Re: [PHP] Re: A stupid question...

I want to sort my a letter in a set colomn. Let say I want to sort
the
colomn last_name

http://www.myserver.com/mysort.php?Letter=A

Like to create a link like A then sort only the last name ore what
ever I
want to sort by that letter.

I hope that's helps. I can order by, but I can't so a sort like the
example
above.

Chuck Payne
Magi Design and Support


on 3/10/02 9:42 PM, Cary at [EMAIL PROTECTED] wrote:

 At 08:24 PM 3/10/02, Chuck \PUP\ Payne wrote:
 Hi,
 
 I not a newie but I am not a pro at mysql either. I want to do a
query by
 letter(a, b, c..ect.). Is there a simple way to do it. I am
writing in PHP.
 So can someone please so me the how.
 
 
 I'm not totally sure what your looking for. If you could elaborate
a little
 I am sure that one of us could help you out.
 
 Cary
 
 
 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




A stupid question...

2002-03-10 Thread Chuck \PUP\ Payne

Hi,

I not a newie but I am not a pro at mysql either. I want to do a query by
letter(a, b, c..ect.). Is there a simple way to do it. I am writing in PHP.
So can someone please so me the how.


 
 | Chuck Payne  |
 | Magi Design and Support  |
 | www.magidesign.com   |
 | [EMAIL PROTECTED]   |
 

BeOS, Macintosh 68K, Classic, and OS X, Linux Support.
Web Design you can afford.

Hartley's Second Law:
Never sleep with anyone crazier than yourself.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: A stupid question...

2002-03-10 Thread Cary

At 08:24 PM 3/10/02, Chuck \PUP\ Payne wrote:
Hi,

I not a newie but I am not a pro at mysql either. I want to do a query by
letter(a, b, c..ect.). Is there a simple way to do it. I am writing in PHP.
So can someone please so me the how.


I'm not totally sure what your looking for. If you could elaborate a little 
I am sure that one of us could help you out.

Cary




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: [PHP] Re: A stupid question...

2002-03-10 Thread Chuck \PUP\ Payne

I want to sort my a letter in a set colomn. Let say I want to sort the
colomn last_name

http://www.myserver.com/mysort.php?Letter=A

Like to create a link like A then sort only the last name ore what ever I
want to sort by that letter.

I hope that's helps. I can order by, but I can't so a sort like the example
above.

Chuck Payne
Magi Design and Support


on 3/10/02 9:42 PM, Cary at [EMAIL PROTECTED] wrote:

 At 08:24 PM 3/10/02, Chuck \PUP\ Payne wrote:
 Hi,
 
 I not a newie but I am not a pro at mysql either. I want to do a query by
 letter(a, b, c..ect.). Is there a simple way to do it. I am writing in PHP.
 So can someone please so me the how.
 
 
 I'm not totally sure what your looking for. If you could elaborate a little
 I am sure that one of us could help you out.
 
 Cary
 
 
 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: [PHP] Re: A stupid question...

2002-03-10 Thread Chuck \PUP\ Payne

I want to sort by a letter in a colomn. Let say I want to sort the colomn
last_name. I can do order by but I can do just the A's.

http://www.myserver.com/mysort.php?Letter=A

Like to create a link on a web A then sort only the last name are A.
 
I hope that's helps. I can order by, but I can't so a sort like the example
above.

Chuck Payne
Magi Design and Support


 on 3/10/02 9:42 PM, Cary at [EMAIL PROTECTED] wrote:
 
 At 08:24 PM 3/10/02, Chuck \PUP\ Payne wrote:
 Hi,
 
 I not a newie but I am not a pro at mysql either. I want to do a query by
 letter(a, b, c..ect.). Is there a simple way to do it. I am writing in PHP.
 So can someone please so me the how.
 
 
 I'm not totally sure what your looking for. If you could elaborate a little
 I am sure that one of us could help you out.
 
 Cary
 
 
 
 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: [PHP] Re: A stupid question...

2002-03-10 Thread michael kimsal

Chuck Pup Payne wrote:
 I want to sort by a letter in a colomn. Let say I want to sort the colomn
 last_name. I can do order by but I can do just the A's.
 
 http://www.myserver.com/mysort.php?Letter=A
 
 Like to create a link on a web A then sort only the last name are A.
  
 I hope that's helps. I can order by, but I can't so a sort like the example
 above.
 
 Chuck Payne
 Magi Design and Support


One of two things to do:

When you're inserting the data, figure out the first letter and store 
that as a separate column (letter perhaps)

Second, probably easier to implement in your case with existing data,
is to use LIKE.

$sql = select * from datatable where last_name like '$letter%';

The % is a wildcard symbol, so if $letter is a then a last name
of adams, aames, aston, etc. would all match.

I know there's someway to have mysql do a string manipulation to compare 
just part of a column's data with something, so you could do something 
similar to a 'substr' in PHP - but it's late and I can't remember off 
the top of my head.


Hope that helps...


--
Michael Kimsal
http://www.phphelpdesk.com
Taking the ? out of ?php
734-480-9961



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: [PHP] Re: A stupid question...

2002-03-10 Thread Daren Cotter

I would think the easiest way would be to use the string functions of MySQL
itself...then you don't have the overhead of the PHP application having to
check each row of data (a wise person on this board once answered a question
similar to this for me).

Somthing like...

$query = SELECT * FROM tbl_name WHERE LEFT(last_name, 1) == 'A');

Using a variable passed in...

$query = SELECT * FROM tbl_name WHERE LEFT(last_name, 1) == '$letter');

NOTE: LEFT() is a special function, I'd consider it a derivative of
SUBSTRING()




-Original Message-
From: michael kimsal [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 10, 2002 8:17 PM
To: Chuck \ Pup\\ Payne
Cc: mysql lists.mysql.com
Subject: Re: [PHP] Re: A stupid question...


Chuck Pup Payne wrote:
 I want to sort by a letter in a colomn. Let say I want to sort the colomn
 last_name. I can do order by but I can do just the A's.

 http://www.myserver.com/mysort.php?Letter=A

 Like to create a link on a web A then sort only the last name are A.

 I hope that's helps. I can order by, but I can't so a sort like the
example
 above.

 Chuck Payne
 Magi Design and Support


One of two things to do:

When you're inserting the data, figure out the first letter and store
that as a separate column (letter perhaps)

Second, probably easier to implement in your case with existing data,
is to use LIKE.

$sql = select * from datatable where last_name like '$letter%';

The % is a wildcard symbol, so if $letter is a then a last name
of adams, aames, aston, etc. would all match.

I know there's someway to have mysql do a string manipulation to compare
just part of a column's data with something, so you could do something
similar to a 'substr' in PHP - but it's late and I can't remember off
the top of my head.


Hope that helps...


--
Michael Kimsal
http://www.phphelpdesk.com
Taking the ? out of ?php
734-480-9961



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: [PHP] Re: A stupid question...

2002-03-10 Thread Demitrious S. Kelly

You haven't given anyone any specifics... nor a link to a phps, so I
cannot be any more specific with my advice


You could probably get away with looking through each of the elements in
the array and using something like 


if ( substr($element, 0, 1) == $letter ( {
Stuff();
}


at least that's how I would go about it if I wanted a quick fix...

$.002 given ;)

cheers

-Original Message-
From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 10, 2002 7:04 PM
To: Chuck PUP Payne; Cary; mysql lists.mysql.com
Cc: PHP General
Subject: Re: [PHP] Re: A stupid question...

I want to sort by a letter in a colomn. Let say I want to sort the
colomn
last_name. I can do order by but I can do just the A's.

http://www.myserver.com/mysort.php?Letter=A

Like to create a link on a web A then sort only the last name are A.
 
I hope that's helps. I can order by, but I can't so a sort like the
example
above.

Chuck Payne
Magi Design and Support


 on 3/10/02 9:42 PM, Cary at [EMAIL PROTECTED] wrote:
 
 At 08:24 PM 3/10/02, Chuck \PUP\ Payne wrote:
 Hi,
 
 I not a newie but I am not a pro at mysql either. I want to do a
query by
 letter(a, b, c..ect.). Is there a simple way to do it. I am writing
in PHP.
 So can someone please so me the how.
 
 
 I'm not totally sure what your looking for. If you could elaborate a
little
 I am sure that one of us could help you out.
 
 Cary
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: [PHP] Re: A stupid question...

2002-03-10 Thread Kim Kohen

G'day Daren

 $query = SELECT * FROM tbl_name WHERE LEFT(last_name, 1) == '$letter');
 NOTE: LEFT() is a special function, I'd consider it a derivative of
 SUBSTRING()

Does MySQL have a function that can selectively return words from a column?

What I'm looking for is the equivalent of rightwords(text,1) which would
return the rightmost word from text. I'm trying to extract the lastname only
from a column which holds the full name (the data is coming from another
database where the first and last names are combined).

Alternatively, is there a way to parse the names during a LOAD?

cheers

Kim
Sql, query


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: probably a stupid question but...

2001-07-08 Thread Jonah Klimack

 Use an index

If you mean use a primary key to create a unique record
regardless of the other data in the row, I've already done
that. However I'm using that primary key as a means of
creating a relationship with another table. 

What I don't want, is the same category name and
customerID twice, even if it does have an index column 
that differentiates it from other rows.

Because, even if there is an index creating a unique row,
there is still the possibility of 2 of the same categorynames 
for one customer. I don't want duplicates like this to
be shown to the user.

Unless I'm misunderstanding what you mean by
using an index...

I'm a bit new to mysql, I've worked a lot with Access,
and I've actually created a flat file relational database
once, but that's it.

Here's the table again:

  
  ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  customerID INT UNSIGNED,
  categoryname VARCHAR(20)
  
  With customer ID pointing to a customers table.
  
  

I've tried this:
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
customerID INT UNSIGNED,
categoryname VARCHAR(20) UNIQUE

but I get an error

Right now I'm trying to figure out what, and how
to use an index for my situation, but I find the 
mysql docs are badly organized and hard
to read.  

any help is much appreciated!




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: probably a stupid question but...

2001-07-08 Thread Don Read


On 08-Jul-01 Jonah Klimack wrote:

 
 What I don't want, is the same category name and
 customerID twice, even if it does have an index column 
 that differentiates it from other rows.
 

 
 I've tried this:
 ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
 customerID INT UNSIGNED,
 categoryname VARCHAR(20) UNIQUE
 
 but I get an error
 
 Right now I'm trying to figure out what, and how
 to use an index for my situation, but I find the 
 mysql docs are badly organized and hard
 to read.  
 

Get your duplicates out then:

ALTER TABLE da_table ADD UNIQUE KEY idx_catcus (categoryname,customerID);
 
Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Perhaps a stupid question about KEY...

2001-07-07 Thread Ken Sommers

HI,
Does it make any sense to create an index on the primary key?

Ken
- Original Message -
From: Paul DuBois [EMAIL PROTECTED]
To: Fournier Jocelyn [Presence-PC] [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Friday, July 06, 2001 3:49 PM
Subject: Re: Perhaps a stupid question about KEY...


 At 12:14 AM +0200 7/7/01, Fournier Jocelyn [Presence-PC] wrote:
 Hi,
 
 Is there any structural difference between a PRIMARY KEY and a UNIQUE key
?
 
 Thanks ;)
 
 Jocelyn Fournier
 Presence-PC
 www.presence-pc.com

 They're mostly the same, with these differences:

 There can only be one PRIMARY KEY per table, whereas you can have multiple
 UNIQUE keys.

 Any columns in a PRIMARY KEY must be declared NOT NULL; UNIQUE keys do
 not have this restriction.

 --
 Paul DuBois, [EMAIL PROTECTED]

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Perhaps a stupid question about KEY...

2001-07-07 Thread Jeremy Zawodny

On Sat, Jul 07, 2001 at 07:22:19AM -0700, Ken Sommers wrote:

 Does it make any sense to create an index on the primary key?

Primary Keys are automatically indexed. In fact, you might say that a
primary key is just a special type of index (it is).

Jeremy
-- 
Jeremy D. Zawodny, [EMAIL PROTECTED]
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878Fax: (408) 349-5454Cell: (408) 439-9951

MySQL 3.23.29: up 21 days, processed 161,614,106 queries (86/sec. avg)

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




probably a stupid question but...

2001-07-07 Thread Jonah Klimack

Hi

I want to enforce unique records in one of my
tables.

The table goes like this:

ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
customerID INT UNSIGNED,
categoryname VARCHAR(20)

With customer ID pointing to a customers table.

I suddenly realized that one customer could input
the same categoryname twice, which would create
a duplicate entry in the database. (if you ignore the
primary key). 

 Is there something in
MySQL, or in my table design, that can force unique records?
Or will I have to check this with my code everytime I
update the database?

Thanks very much for any help! Much appreciated.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: probably a stupid question but...

2001-07-07 Thread Justin Farnsworth

Use an index.

--

Jonah Klimack wrote:
 
 Hi
 
 I want to enforce unique records in one of my
 tables.
 
 The table goes like this:
 
 ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
 customerID INT UNSIGNED,
 categoryname VARCHAR(20)
 
 With customer ID pointing to a customers table.
 
 I suddenly realized that one customer could input
 the same categoryname twice, which would create
 a duplicate entry in the database. (if you ignore the
 primary key).
 
  Is there something in
 MySQL, or in my table design, that can force unique records?
 Or will I have to check this with my code everytime I
 update the database?
 
 Thanks very much for any help! Much appreciated.
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-- 
Justin Farnsworth
Eye Integrated Communications
321 South Evans - Suite 203
Greenville, NC 27858 | Tel: (252) 353-0722

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Perhaps a stupid question about KEY...

2001-07-06 Thread Paul DuBois

At 12:14 AM +0200 7/7/01, Fournier Jocelyn [Presence-PC] wrote:
Hi,

Is there any structural difference between a PRIMARY KEY and a UNIQUE key ?

Thanks ;)

Jocelyn Fournier
Presence-PC
www.presence-pc.com

They're mostly the same, with these differences:

There can only be one PRIMARY KEY per table, whereas you can have multiple
UNIQUE keys.

Any columns in a PRIMARY KEY must be declared NOT NULL; UNIQUE keys do
not have this restriction.

-- 
Paul DuBois, [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: STUPID QUESTION

2001-03-26 Thread Cal Evans

In MySQL, you can create tables that have relationships but you can't create
what a lot of people call "Foreign Key relationships". In reality you CAN
create Foreign key (FK) relationships between tables, you just can't create
constraints that enforce them automatically.

Example time:

Let's say I have 2 tables, person and phone.

person

personID PK

name
phoneID  FK


phone

phoneID

phoneNumber


See the phoneID in the person table? In it we store the value of
phone.phoneID for this person's phone number.  This is a Foreign key
relationship. (So named because we are storing a foreign primary key in our
table.)  In other implementations of SQL, you could define a constraint
(rule) that says that you can't store a value in person.phoneID that does
not exist in phone.phoneID.  This is a Foreign Key Constraint.

So, to answer your question, to create a FK relationship between 2 tables,
put a field in table1 of the same type (does not have to be the same name
but I always do) as the primary key of table 2.

Then when you are selecting and want to gather everything together you use:

Select t1.*,
   t2.*
  from table1 t1,
   table2 t2
 where t1.t2ID = t2.t2ID

Clear as mud?

Cal
http://www.calevans.com


-Original Message-
From: GERARDO GALLARDO [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 26, 2001 5:57 PM
To: [EMAIL PROTECTED]
Subject: STUPID QUESTION


I'm new to MySQL and SQL in general.  I have been searching and searching
but I can't find an answer to a question which I know is simple.  I have
read a book called Teach Yourself MySQL in 21 days.  It talkes about
defining relationships between tables but it never actually shows you how
you would create these relationships or reference data from one table in
another table.  How do I do this?  Please help.
Gerardo

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: STUPID QUESTION

2001-03-26 Thread Chris Becker

Note that foreign keys in SQL are not used to join tables, but are used
mostly for checking referential integrity (foreign key constraints). If you
want to get results from multiple tables from a SELECT statement, you do
this by joining tables:

SELECT * from table1,table2 where table1.id = table2.id;

or use alias

SELECT t1.ID, t2.Name from table1 t1, table2 t2 where t1.id = t2.id

ChrisB

-Original Message-
From: GERARDO GALLARDO [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 26, 2001 3:57 PM
To: [EMAIL PROTECTED]
Subject: STUPID QUESTION


I'm new to MySQL and SQL in general.  I have been searching and searching
but I can't find an answer to a question which I know is simple.  I have
read a book called Teach Yourself MySQL in 21 days.  It talkes about
defining relationships between tables but it never actually shows you how
you would create these relationships or reference data from one table in
another table.  How do I do this?  Please help.
Gerardo

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: STUPID QUESTION

2001-03-26 Thread Rolf Hopkins

Quite simple, you can't.  Please read the manuals more thoroughly.  You
can't just read a general book on SQL by itself without reading the manual
for your particular flavour of SQL.  Each type of database may have added
extra features or have removed some from the standard SQL.


- Original Message -
From: "GERARDO GALLARDO" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 27, 2001 7:56
Subject: STUPID QUESTION


 I'm new to MySQL and SQL in general.  I have been searching and searching
but I can't find an answer to a question which I know is simple.  I have
read a book called Teach Yourself MySQL in 21 days.  It talkes about
defining relationships between tables but it never actually shows you how
you would create these relationships or reference data from one table in
another table.  How do I do this?  Please help.
 Gerardo

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php