Re: Adding Record to database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks a lot guys.  I thought I had something auto incremented, but I
didn't.  That was the problem.  Thanks for your help.

Matt

"Miles Thompson" <milesthompson@ns.sympatico.ca> wrote in message
5.2.0.9.0.20030202220935.01994950@pop1.ns.sympatico.ca">news:5.2.0.9.0.20030202220935.01994950@pop1.ns.sympatico.ca...
> Matt,
>
> Check a couple of things:
>
> 1. Do you have a primary key with unique id? You could be getting a key
> violation.
> 2. Echo $query and confirm that it is as you expect.
> 3. Add code to trap for, or at least display any generated error.
> 4. Are you able to test this INSERT at the MySQL console?
>
> If so, and it works, compare what works in 4. with what you have at 2.
>
> HTH -Miles
>
>
> At 08:41 PM 2/2/2003 -0500, Matt wrote:
> >Hi.  I am having a problem with adding a record into a table of a
database.
> >I have attached the code I am using to accomplish this.  It works if the
> >table is empty, but if there is already a record in the table, it won't
add
> >anything.  Could anyone help me out with this?  Here is the code I am
using:
> >
> >$query = "INSERT INTO TableName
>
>(SID,StudentLastName,StudentFirstName,StudentEmail,StudentLoginName,Student
P
> >assword) VALUES
>
>('$SID','$StudentLastName','$StudentFirstName','$StudentEmail','$StudentLog
i
> >nName','$StudentLoginPassword')";
> >$results = mysql_query($query);
> >
> >Like I said, this works if the table is totally empty, but if there is
> >already an entry in there, it does nothing.  Please help if you can.
> >Thanks.
> >
> >Matt
> >
> >
> >
> >--
> >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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux