Search
Left Quote    You have to THINK anyway, so why not think BIG?
- Donald Trump    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Table HELP!
  This user is offline  gravy
  Subject: "Table HELP!" Posted: @ 6:48 pm on Jun 11 2007   

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

Just kidding guys, I do need help but its not pressing.
Here is my deal.

I have this code all running at one site and works fine, but I uploaded everything the same way at another site with the same hosting and I get this error when I try to insert info to the database:

Duplicate Entry for 'admin' 1

admin being the username. this only happens on multiple uploads of images. I am pulling me f'ing hair out here folks!
Here is my table code for creating"< br />
Code:

CREATE TABLE `files` (
`username` varchar(25) NOT NULL default'',
`image` varchar(255) NOT NULL default'',
PRIMARY KEY (`username`)
) TYPE=MyISAM;



Its most likely that i wrote that wrong, but why does it work at one and not the other.

my process page uses this code:

Code:

if(!isset($_SES SION['username' ]) && !isset($_SESSIO N['password'])) {
$_SESSION['logg ed_in'] = 0;
$user = "Guest&quo t;;
}else if ($_SESSION['log ged_in'] == 1 ) {
$user = $_SESSION['user name'];
$image = $_POST["im age"];
add_photo($user , $filename);
}
}



and my functions is using this code:

Code:

// Track file for user
function add_photo($user , $filename){
// Insert a row of information into the table
mysql_query(&qu ot;INSERT INTO files (username, image) VALUES ('$user', '$filename')&qu ot
or die(mysql_error ());
}


any help?


Photo Hosting Scripts? It's what I do....
    Viewed: 3,544 Times | Reply to This | To top
  This user is offline  gravy
  Subject: "re: Table HELP!" Posted: @ 11:54 pm on Jun 11 2007    

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

  gravy said...

< i> Just kidding guys, I do need help but its not pressing.
Here is my deal.

I have this code all running at one site and works fine, but I uploaded everything the same way at another site with the same hosting and I get this error when I try to insert info to the database:

Duplicate Entry for 'admin' 1

admin being the username. this only happens on multiple uploads of images. I am pulling me f'ing hair out here folks!
Here is my table code for creating"

Code:

CREATE TABLE `files` (
`username` varchar(25) NOT NULL default'',
`image` varchar(255) NOT NULL default'',
PRIMARY KEY (`username`)
) TYPE=MyISAM;



Its most likely that i wrote that wrong, but why does it work at one and not the other.

my process page uses this code:

Code:

if(!isset($_SES SION['username ']) && !isset($_SESSIO N['password'] )) {
$_SESSION['log ged_in'] = 0;
$user = "Guest&q uot;;
}else if ($_SESSION['lo gged_in'] == 1 ) {
$user = $_SESSION['use rname'];
$image = $_POST["i mage"];
add_photo($user , $filename);
}
}



and my functions is using this code:

Code:

// Track file for user
function add_photo($user , $filename){
// Insert a row of information into the table
mysql_query(&q uot;INSERT INTO files (username, image) VALUES ('$user', '$filename') "
or die(mysql_error ());
}


any help?

Nevermind I fixed it...stupid mistake really...




Photo Hosting Scripts? It's what I do....

    Viewed: 3,536 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank