[PHP-DB] Re: never seen this before..

2002-06-24 Thread Seth Yount

I believe your assumption is correct.  VARCHAR is not the best datatype 
suitable for indexing.  I understand why you want to utilize this type, 
so that you are not storing empty characters.  I am assuming that the id 
column is numerical in nature.  In that case, make the data type INT. 
This way it increments just a number and it only stores the amount of 
characters needed.

i.e.  : id INT NOT NULL auto_increment,

This should solve your problem, post again if not

gl -- Seth


Jas wrote:

> Here is the db table structure...
> CREATE TABLE demo_sessions (
>id varchar(255) NOT NULL auto_increment,
>ipaddy varchar(255) NOT NULL,
>date varchar(255) NOT NULL,
>PRIMARY KEY (id)
> );
> Let me know if this is correct, I have a feeling that the varchar is my
> problem but I could be wrong.
> TIA
> Jas
> 
> <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 
>>TIA --
>>
>>
>>column in your table denotes your primary key? After that, how is it
>>incremented? Is it auto or do you have some other form of it.  I think
>>your code is correct so the error seems to be how the data ID is
>>
> generated.
> 
>>gl -- Seth
>>
>>Jas wrote:
>>
>>
>>>I am getting an error when inserting data into a mysql database table.
>>>
> It
> 
>>>is telling me that there is a duplicate entry in the database everytime
>>>
> it
> 
>>>gets 10 records inserted to the table, if I flush the table and try it
>>>
> again
> 
>>>it works fine.  Is there some kind of limit on some tables?  Here is the
>>>error php outputs once the table gets 10 records: Duplicate entry '10'
>>>
> for
> 
>>>key 1
>>>Here is the code...
>>>require '/home/web/b/bignickel.net/scripts/admin/db.php';
>>> $table = "demo_sessions";
>>> $sql_insert = "INSERT INTO $table (ipaddy,date) VALUES
>>>('$ipaddy','$date')" or die('Could not insert client info');
>>> $result = @mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());
>>>
>>>Any help on this would be great
>>>TIA
>>>Jas
>>>
>>>
>>>
>>>
> 
> 


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




RE: [PHP-DB] Re: never seen this before..

2002-06-24 Thread Cosby, Christopher

Must be an old or broken version of mysql.  I'm running 3.23.50 and it won't
even allow the `id' field to be a varchar(255).  Change it to int() and
watch the magic.

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]] 
Sent: Monday, June 24, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: never seen this before..


Here is the db table structure...
CREATE TABLE demo_sessions (
   id varchar(255) NOT NULL auto_increment,
   ipaddy varchar(255) NOT NULL,
   date varchar(255) NOT NULL,
   PRIMARY KEY (id)
);
Let me know if this is correct, I have a feeling that the varchar is my
problem but I could be wrong. TIA Jas

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> TIA --
>
>
> column in your table denotes your primary key? After that, how is it 
> incremented? Is it auto or do you have some other form of it.  I think 
> your code is correct so the error seems to be how the data ID is
generated.
>
> gl -- Seth
>
> Jas wrote:
>
> > I am getting an error when inserting data into a mysql database 
> > table.
It
> > is telling me that there is a duplicate entry in the database 
> > everytime
it
> > gets 10 records inserted to the table, if I flush the table and try 
> > it
again
> > it works fine.  Is there some kind of limit on some tables?  Here is 
> > the error php outputs once the table gets 10 records: Duplicate 
> > entry '10'
for
> > key 1
> > Here is the code...
> > require '/home/web/b/bignickel.net/scripts/admin/db.php';
> >  $table = "demo_sessions";
> >  $sql_insert = "INSERT INTO $table (ipaddy,date) VALUES 
> > ('$ipaddy','$date')" or die('Could not insert client info');
> >  $result = @mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());
> >
> > Any help on this would be great
> > TIA
> > Jas
> >
> >
> >
>



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


 - - - - - - -  Appended by Scientific-Atlanta, Inc.  - - - - - - -  
This e-mail and any attachments may contain information which is confidential, 
proprietary, privileged or otherwise protected by law. The information is solely 
intended for the named addressee (or a person responsible for delivering it to the 
addressee). If you are not the intended recipient of this message, you are not 
authorized to read, print, retain, copy or disseminate this message or any part of it. 
If you have received this e-mail in error, please notify the sender immediately by 
return e-mail and delete it from your computer. 




[PHP-DB] Re: never seen this before..

2002-06-24 Thread Jas

Here is the db table structure...
CREATE TABLE demo_sessions (
   id varchar(255) NOT NULL auto_increment,
   ipaddy varchar(255) NOT NULL,
   date varchar(255) NOT NULL,
   PRIMARY KEY (id)
);
Let me know if this is correct, I have a feeling that the varchar is my
problem but I could be wrong.
TIA
Jas

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> TIA --
>
>
> column in your table denotes your primary key? After that, how is it
> incremented? Is it auto or do you have some other form of it.  I think
> your code is correct so the error seems to be how the data ID is
generated.
>
> gl -- Seth
>
> Jas wrote:
>
> > I am getting an error when inserting data into a mysql database table.
It
> > is telling me that there is a duplicate entry in the database everytime
it
> > gets 10 records inserted to the table, if I flush the table and try it
again
> > it works fine.  Is there some kind of limit on some tables?  Here is the
> > error php outputs once the table gets 10 records: Duplicate entry '10'
for
> > key 1
> > Here is the code...
> > require '/home/web/b/bignickel.net/scripts/admin/db.php';
> >  $table = "demo_sessions";
> >  $sql_insert = "INSERT INTO $table (ipaddy,date) VALUES
> > ('$ipaddy','$date')" or die('Could not insert client info');
> >  $result = @mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());
> >
> > Any help on this would be great
> > TIA
> > Jas
> >
> >
> >
>



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




[PHP-DB] Re: never seen this before..

2002-06-24 Thread user

TIA --


column in your table denotes your primary key? After that, how is it 
incremented? Is it auto or do you have some other form of it.  I think 
your code is correct so the error seems to be how the data ID is generated.

gl -- Seth

Jas wrote:

> I am getting an error when inserting data into a mysql database table.  It
> is telling me that there is a duplicate entry in the database everytime it
> gets 10 records inserted to the table, if I flush the table and try it again
> it works fine.  Is there some kind of limit on some tables?  Here is the
> error php outputs once the table gets 10 records: Duplicate entry '10' for
> key 1
> Here is the code...
> require '/home/web/b/bignickel.net/scripts/admin/db.php';
>  $table = "demo_sessions";
>  $sql_insert = "INSERT INTO $table (ipaddy,date) VALUES
> ('$ipaddy','$date')" or die('Could not insert client info');
>  $result = @mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR());
> 
> Any help on this would be great
> TIA
> Jas
> 
> 
> 


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