Re: mySQL?!

From: Date: Fri, 07 Jul 2000 10:18:37 +0000
Subject: Re: mySQL?!
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-929@lists.php.net to get a copy of this message
What kind of a result do you expect from an INSERT query? It seems to me that $insertresult will either be true or false. Something at the end of your snippet like the following might be of some help (note that I do not use MySQL, so I had to make this up on the fly): if ($insertresult) { echo "Record Inserted, please add more."; } else { echo "Database error! The record was not inserted.<BR>"; echo "The MySQL error was: #"; echo mysql_errno(); echo " -- "; echo mysql_error(); echo "<BR>"; } Doug At 10:57 AM 7/7/00 +0200, Fredrik Arild Takle wrote: >I am working on a form to insert books in a mySQL database, I belove you can see the source of do_insert.phtml, i also have a page named insert.phtml w/ forms, the textboxes are named title, author, publisher.... I don't get any results of my INSERT command... > >pwinfo.php contains information about how to connect to mySQL database, common.php is often used commands! > >I can't find the error, what could i do different? Should I include it all in one page? How? > ><? > require 'pwinfo.php'; > require 'common.php'; > > >$insertquery = "INSERT INTO biblio_main (no, title, author, publisher, year, section, status, ISBN, date, bokid) VALUES ('$no', '$title', '$author', '$publisher', '$year', '$section', '$status', '$isbn', '$date', '$bokid')"; >$insertresult = mysql_query ($insertquery); > ?> > >PS! I have the same problem when updating books that already are registered! > >Best Regards >Fredrik Arild Takle >ftakle@online.no >NORWAY

« previous php.db (#929) next »