Re: I need an expert to tell me what I am doing wrong
| From: | David Robley | Date: | Mon, 26 Mar 2001 01:18:19 +0000 |
| Subject: | Re: I need an expert to tell me what I am doing wrong | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45549@lists.php.net to get a copy of this message | ||
On Sat, 24 Mar 2001 11:07, YoBro wrote:
> What could I possibly be doing wrong here. The information just will
> not insert into my database.
> ARGH!
>
> Please help if you can...
>
> <?php
>
> $user = "xyz";
> $pass = "123";
>
>
> //Connect to Database xyz
> $db = mysql_connect("localhost", $user, $pass)OR DIE("Unable to connect
> to database");
>
> mysql_select_db("xyz",$db) OR DIE("Unable to connect to database");
>
> $sql = ("INSERT INTO orders VALUES
> 'product,name,email'($product,$name,$email)");
> $result = mysql_query($sql);
echo mysql_error();
> echo "Order for the $product has been sent";
>
>
> ?>
I think you got the solution to your problem, but for future debugging
you might want to add the line above which will spit out a meaningful
error message. You could of course combine that with mysql_errno() for
some error handling branching.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA