Re: [PHP-DB] drop list inserts

2002-04-18 Thread Christian Schneider

Hi Barry,

Barry Rumsey wrote:
   $query_id = mysql_query(INSERT INTO music_album VALUES
 (NULL, '$music_artist.id' ,'$album' ,NULL ,NULL));
 echo  $artist_name and $album has been added to the 
 
 Could someone please point out what I'm doing wrong?
 

is the value of $music_artist.id correct? Also, your select has the 
name of music_artist and the value of the respective id, isn't that 
what you want?


Regards,

Christian


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




RE: [PHP-DB] drop list inserts

2002-04-18 Thread Gurhan Ozen

Barry,
All I saw was $artist_name variable that will be passed thru the form.. Can
you do a
echo $music_artist.id   to see if it has a value ..
And you still need to get rid of $query_id =  in the line that you are
trying to do insert.

Gurhan

-Original Message-
From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 7:35 PM
To: php-db list
Subject: RE: [PHP-DB] drop list inserts


The $music_artist.id is the id from the first page. ( database = music ,
table = music_artist  id ). This is what I need, a drop down list of the
artists in table 'music_artist'( I've got this), I want the id of the
artist they selected in the drop list to be inserted into the
table 'music_album' as $artist_id.

-Original Message-
From: Gurhan Ozen [EMAIL PROTECTED]
To: Barry Rumsey [EMAIL PROTECTED], php-db list php-
[EMAIL PROTECTED]
Date: Wed, 17 Apr 2002 19:02:52 -0400
Subject: RE: [PHP-DB] drop list inserts

 Hi Barry,
 First of all,
 $query_id = mysql_query(INSERT INTO...);  is wrong. That line will
 just
 assign the resultset of the whatever mysql_query() function returns to
 the
 variable $query_id .. Get rid of $query_id and just have
 mysql_query(INSERt
 INTO ); See: http://www.php.net/manual/en/function.mysql-query.php
 for
 this..
 Second of all, in your INSERT INTO query you are trying to insert the
 value
 of a variable called $music_artist.id which doesn't exist anywhere. I
 think
 you meant to insert $artist_name instead???

 Gurhan


 -Original Message-
 From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 17, 2002 6:23 PM
 To: php-db list
 Subject: [PHP-DB] drop list inserts


 I have the following to pages( just testing them at the moment ):
 ? mysql_connect(host,,);
 mysql_select_db(music);
 echo form name='add_album' method='post'
 action='test-album-add.php';
 $getlist = mysql_query(SELECT * FROM music_artist ORDER BY
 artist_name ASC);
 echo  Artist Name : select name=\artist_name\\n;
 while ($row = mysql_fetch_array($getlist)) {
 echo 'option
 value='.$row[id].''.$row[artist_name]./option\n;
 }
 echo  /select\n;
 echo brAlbum Name : input type='text' name='album'
 value='$album';
 echo input type='submit' name='Submit' value='Submit';
 echo /form;
 ?

 and

 ?
 include(../mainfile.php);
 include(../header.php);
 OpenTable();

   mysql_connect( host, ,  );
   mysql_select_db( xoops );

   $query_id = mysql_query(INSERT INTO music_album VALUES
 (NULL, '$music_artist.id' ,'$album' ,NULL ,NULL));
 echo  $artist_name and $album has been added to the
 database.;
 CloseTable();
 include(../footer.php);
 ?

 What I am trying to do is insert the id of the artist they selected in
 the first page into a second table. At the moment all I get is 0
 inserted instead of the artist id from page 1.

 Could someone please point out what I'm doing wrong?

 Thanks in advance.



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


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




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


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




Re: [PHP-DB] drop list inserts

2002-04-18 Thread Barry Rumsey

Yes I see what I have done wrong. I named it music_artist instead of 
nameing it music_artist.id

Sorry about that but thanks for the help. I think I'll need more help as 
I'm still learning.

-Original Message-
From: Christian Schneider [EMAIL PROTECTED]
To: Barry Rumsey [EMAIL PROTECTED]
Date: Thu, 18 Apr 2002 12:17:34 +0200
Subject: Re: [PHP-DB] drop list inserts

 Hi Barry,
 
 Barry Rumsey wrote:
$query_id = mysql_query(INSERT INTO music_album VALUES
  (NULL, '$music_artist.id' ,'$album' ,NULL ,NULL));
echo  $artist_name and $album has been added to the 
  
  Could someone please point out what I'm doing wrong?
  
 
 is the value of $music_artist.id correct? Also, your select has the 
 name of music_artist and the value of the respective id, isn't that 
 what you want?
 
 
 Regards,
 
 Christian
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




RE: [PHP-DB] drop list inserts

2002-04-17 Thread Gurhan Ozen

Hi Barry,
First of all,
$query_id = mysql_query(INSERT INTO...);  is wrong. That line will just
assign the resultset of the whatever mysql_query() function returns to the
variable $query_id .. Get rid of $query_id and just have mysql_query(INSERt
INTO ); See: http://www.php.net/manual/en/function.mysql-query.php  for
this..
Second of all, in your INSERT INTO query you are trying to insert the value
of a variable called $music_artist.id which doesn't exist anywhere. I think
you meant to insert $artist_name instead???

Gurhan


-Original Message-
From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 6:23 PM
To: php-db list
Subject: [PHP-DB] drop list inserts


I have the following to pages( just testing them at the moment ):
? mysql_connect(host,,);
mysql_select_db(music);
echo form name='add_album' method='post' action='test-album-add.php';
$getlist = mysql_query(SELECT * FROM music_artist ORDER BY
artist_name ASC);
echo  Artist Name : select name=\artist_name\\n;
while ($row = mysql_fetch_array($getlist)) {
echo 'option value='.$row[id].''.$row[artist_name]./option\n;
}
echo  /select\n;
echo brAlbum Name : input type='text' name='album' value='$album';
echo input type='submit' name='Submit' value='Submit';
echo /form;
?

and

?
include(../mainfile.php);
include(../header.php);
OpenTable();

  mysql_connect( host, ,  );
  mysql_select_db( xoops );

  $query_id = mysql_query(INSERT INTO music_album VALUES
(NULL, '$music_artist.id' ,'$album' ,NULL ,NULL));
  echo  $artist_name and $album has been added to the
database.;
CloseTable();
include(../footer.php);
?

What I am trying to do is insert the id of the artist they selected in
the first page into a second table. At the moment all I get is 0
inserted instead of the artist id from page 1.

Could someone please point out what I'm doing wrong?

Thanks in advance.



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


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




RE: [PHP-DB] drop list inserts

2002-04-17 Thread Barry Rumsey

The $music_artist.id is the id from the first page. ( database = music , 
table = music_artist  id ). This is what I need, a drop down list of the 
artists in table 'music_artist'( I've got this), I want the id of the 
artist they selected in the drop list to be inserted into the 
table 'music_album' as $artist_id.

-Original Message-
From: Gurhan Ozen [EMAIL PROTECTED]
To: Barry Rumsey [EMAIL PROTECTED], php-db list php-
[EMAIL PROTECTED]
Date: Wed, 17 Apr 2002 19:02:52 -0400
Subject: RE: [PHP-DB] drop list inserts

 Hi Barry,
 First of all,
 $query_id = mysql_query(INSERT INTO...);  is wrong. That line will
 just
 assign the resultset of the whatever mysql_query() function returns to
 the
 variable $query_id .. Get rid of $query_id and just have
 mysql_query(INSERt
 INTO ); See: http://www.php.net/manual/en/function.mysql-query.php 
 for
 this..
 Second of all, in your INSERT INTO query you are trying to insert the
 value
 of a variable called $music_artist.id which doesn't exist anywhere. I
 think
 you meant to insert $artist_name instead???
 
 Gurhan
 
 
 -Original Message-
 From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 17, 2002 6:23 PM
 To: php-db list
 Subject: [PHP-DB] drop list inserts
 
 
 I have the following to pages( just testing them at the moment ):
 ? mysql_connect(host,,);
 mysql_select_db(music);
 echo form name='add_album' method='post'
 action='test-album-add.php';
 $getlist = mysql_query(SELECT * FROM music_artist ORDER BY
 artist_name ASC);
 echo  Artist Name : select name=\artist_name\\n;
 while ($row = mysql_fetch_array($getlist)) {
 echo 'option
 value='.$row[id].''.$row[artist_name]./option\n;
 }
 echo  /select\n;
 echo brAlbum Name : input type='text' name='album'
 value='$album';
 echo input type='submit' name='Submit' value='Submit';
 echo /form;
 ?
 
 and
 
 ?
 include(../mainfile.php);
 include(../header.php);
 OpenTable();
 
   mysql_connect( host, ,  );
   mysql_select_db( xoops );
 
   $query_id = mysql_query(INSERT INTO music_album VALUES
 (NULL, '$music_artist.id' ,'$album' ,NULL ,NULL));
 echo  $artist_name and $album has been added to the
 database.;
 CloseTable();
 include(../footer.php);
 ?
 
 What I am trying to do is insert the id of the artist they selected in
 the first page into a second table. At the moment all I get is 0
 inserted instead of the artist id from page 1.
 
 Could someone please point out what I'm doing wrong?
 
 Thanks in advance.
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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