[PHP] Re: mysql query . need help!!!!!

2001-09-04 Thread _lallous

Nope,
MySql doesn't allow select within select...
try making two seperate queries...

Lizlynch [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
i have two tables here, i want to insert the customername from the Username
table and insert it into the Classification table.
 is the below query correct cause i can't seem to get it to work.

 $query = INSERT INTO Classification (Customername)
 (SELECT Customername)
  FROM Username
  WHERE Username = '$Username');

i also want to insert a form value into the classification table at the same
time is that possible.

cheers liz lynch







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: mysql query . need help!!!!!

2001-09-04 Thread sagar

You cant use a select statement withoug using a table name.
check out this
$query = insert into classification(customername) (select customername from username 
where username='$username');

i cant answer ur second question, since i dont the
structure of your table

/sagar

original message 


Nope,
MySql doesn't allow select within select...
try making two seperate queries...

Lizlynch [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
i have two tables here, i want to insert the customername from the Username
table and insert it into the Classification table.
 is the below query correct cause i can't seem to get it to work.

 $query = INSERT INTO Classification (Customername)
 (SELECT Customername)
  FROM Username
  WHERE Username = '$Username');

i also want to insert a form value into the classification table at the same
time is that possible.

cheers liz lynch





Re: [PHP] Re: mysql query . need help!!!!!

2001-09-04 Thread Jon Farmer

You cant use a select statement withoug using a table name.
check out this
$query = insert into classification(customername) (select customername
from username where username='$username');

Incorrect in mySQL you can do

mysql select 3+5;

returns 8

plus a whole lot of other functions that can be selected without a table
name.


Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07968 524175
PGP Key available, send blank email to [EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]