You are here: SQL statments advice « PHP Language « IT news, forums, messages
SQL statments advice

Posted by Brian on 10/16/74 11:22

Hi all



I need some advise on how to approach this, I am building a site that
handles images, blocks of images (profiles) and assigning profiles to banks.
I can't change the structure of any of the tables (third party connecting to
them)



I'm trying to work out the best way to achieve the following so open to any
ideas anybody may have



1) If the user deletes an images from the 'advertlibrary' table, it will
delete the file from the server, and delete that entry from the table by
using the 'filename' as the pointer (the filename is always unique). That I
can do, now what I need to work out is how to delete all references to this
image from the 'profiles' table.

In the 'profiles' table there are 60 fields, filename1 description1,
supplier1 . filename20 description20, supplier20, I need to scan though the
table and look the 'filename', if I found the filename in say Filname4 and
Filname8 then I need to do the following:
filename4 = null
description4 = null
supplier4 = null,

filename8 = null
description8 = null
supplier8 = null,



So it now removes references to that filename, but I have to do this for
every entry in the 'profiles' table that matches the filename.



2) Renaming a profile: Each profile has a name (always unique for the user)
If the user wants to rename it, I need to run a straight forward update to
change the name on the 'profiles' table. Now I need update any references to
the old name and update it in the 'conf' table where is belongs to that
user. In the 'conf' table there are 24 fields numbered bank1 - bank24 to I
need to say something like



if bank1 = old name and user = x then update to new name, but got to run
this on all 24 banks and all entries in the 'conf' table



3) Removing a profile: Similar to deleting an image, run a deleted on the
'profiles' table now find any references the profile name in the 'conf'
table and remove it



if bank1 = profile name and user = x then set bank1 to null, once again need
to run this on all 24 banks and all entries in the 'conf' table




There maybe a quick way of doing this, but there again maybe not, so any
suggestions would be great



Thanks



Brian

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация