Re: [PHP] Why would this command just Die!

2002-05-20 Thread Rasmus Lerdorf

Change your die() call to this:

 die(mysql_error())

so you can actually see what is going on.

-Rasmus

On Mon, 20 May 2002, Php Developers wrote:

 This command just dies!

 I have checked sql connection  ... ok
 the insert into line ... ok

 Pfft it just don't wanna work


 ?php

  $answers=$band, $middlename, $pot;
  $date=date (l dS of F Y h:i:s A);

   $sql = INSERT INTO prizeline (id, email, name, address, answers, date) VALUES 
('', '$email', '$name', '$address', '$answers', '$date');

   echo $sql;

   mysql_query($sql) or die (There has been an error);


 ?


 ## Out put on page ##

 INSERT INTO prizeline (id, email, name, address, answers, date) VALUES ('', 
'[EMAIL PROTECTED]', 'newman', '12 Newman ave Auckland', 'In Season, James, 
John', 'Monday 20th of May 2002 10:22:05 AM')There has been an error



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




Re: [PHP] Why would this command just Die!

2002-05-19 Thread Julie Meloni

PD ?php
PD  $answers=$band, $middlename, $pot;
PD  $date=date (l dS of F Y h:i:s A);
PD   $sql = INSERT INTO prizeline (id, email, name, address, answers, date) VALUES 
('', '$email', '$name', '$address', '$answers', '$date');
PD   echo $sql;
PD   mysql_query($sql) or die (There has been an error);
PD ?

If this is all of your script, then you are missing those pesky
connect to server and select database functions.

If you replace your die message with die(mysql_error()) you will
probably see a very helpful error message such as no database
selected or hey buddy, not connected.


- Julie

-- Julie Meloni
-- [EMAIL PROTECTED]
-- www.thickbook.com

Find Sams Teach Yourself MySQL in 24 Hours at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20


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




RE: [PHP] Why would this command just Die!

2002-05-19 Thread David Freeman



  INSERT INTO prizeline (id, email, name, address, answers, 
  date) VALUES ('', '[EMAIL PROTECTED]', 'newman', 
  '12 Newman ave Auckland', 'In Season, James, John', 'Monday 
  20th of May 2002 10:22:05 AM')There has been an error

If you want 'id' to be assigned by the database (I'm assuming you have
an auto_increment on that field) then don't put it in your insert at
all.  The database will figure it out.  As it is you're trying to assing
the id to '' (or nothing) which may well be why you're getting the
error.

(and this relates to php in what way?  Perhaps an sql mailing list would
have been a more appropriate place...)

CYA, Dave



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