PDA

View Full Version : SQL help....


DannyBoy8406
08-07-2003, 05:50 AM
alright....i posted this somewhere else, but now i realize it should have gone in here.....sorry, I'm new at this and just learning my way around here.....

I installed the "Member Photo Gallery" hack and to post member's photos you have to run an SQL query:

INSERT INTO photogallery VALUES (xxx, 'full-photo-URL', 'thumb-photo-URL', '');


xxx is replaced by the user id of the member.....




what query would you run to change a member's picture or delete it from the table?

When I try to put in a different photo, this is what I get...


Database error in vBulletin Control Panel 2.2.9:

Invalid SQL: INSERT INTO photogallery VALUES (5, 'http://www.wb-devotions.com/avatar.php?userid=5&dateline=1060140488', 'http://www.wb-devotions.com/avatar.php?userid=5&dateline=1060140488', '');

mysql error: Duplicate entry '5' for key 1

mysql error number: 1062

ImportPassion
08-07-2003, 10:40 AM
I don't know what that table looks like, but try


INSERT INTO photogallery VALUES (NULL,5, 'http://www.wb-devotions.com/avatar.php?userid=5&dateline=1060140488', 'http://www.wb-devotions.com/avatar.php?userid=5&dateline=1060140488', '');

Velocd
08-07-2003, 11:20 PM
I would uninstall that hack and install mine, just being it is far more convienant. ;)

(no running queries each time if you want to add a photo)

https://vborg.vbsupport.ru/showthread.php?s=&threadid=49565

g-force2k2
08-08-2003, 05:16 AM
i would suggest using Velocd's as well even though i haven't seen the code i can assure that its more proficient.

As for your sql error its because there's already a value for the 5th user.

in that case you have two options...

you can either update the query or you can deleted the column and then reinsert it...

i don't know the specifications but if you can give me the table layout i can help you with the queries.

but i would go with the third option and use Velocd's hack...

regards,
g-force2k2

DannyBoy8406
08-08-2003, 06:05 AM
here's the query i ran to setup the table...

CREATE TABLE photogallery (
userid int(10) unsigned NOT NULL default '0',
photo_full varchar(100) NOT NULL default '',
photo_thumb varchar(100) NOT NULL default '',
comments mediumtext NOT NULL,
PRIMARY KEY (userid)
) TYPE=MyISAM;

thx for helping BTW..

g-force2k2
08-08-2003, 06:30 AM
hey k thanks for the info give me a minute and i'll create a file for you to use in combination with the hack...

regards,

g-force2k2

g-force2k2
08-08-2003, 06:57 AM
don't know if it will be a 100% efficient but i tested it on my localhost and no parse errors were returned...

as for its functionality let me know if i have to fix anything :)

upload file to admin folder and then call the file by

yourforumurl/admin/photoadmin.php

regards,
g-force2k2

DannyBoy8406
08-08-2003, 06:44 PM
working like a dream! thanks alot man!!!!