473,789 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difficulty updating multiple images,need a hand !

58 New Member
Hey you all !
Happy holidays !


I have 2 tables:
Ads
ad_id primary
...
..

Adimages
image_id primary
ad_id FK
......
.....

I make sure to link each ad to its multiple corresponding images,using this:
$ad_id1 = "";
if($ad_id1 != $ad_id){
$ad_id1 = $ad_id;
}

so ad_id=58 in Ad table,will have 3 corresponding images(3 Foreign keys ad_id=58) in Adimages

am tyring to edit a user ad that is linked to 3 images:
image1
image2
image3
If a user wants to replace the images with new ones,say replace all three with just one-image4

i run this query:

[php]
$query="UPDATE Adimages SET name='$newfile' ,type='$type',s ize='$size',pat h='$path' WHERE ad_id='$ad_id' ";
mysql_query($qu ery,$conn);
[/php]

The result I get is:
image4
image4
image4

normal,since all the images have the same foreign key(ad_id) related to one primary key(ad_id) on which the WEHRE clause was based.

How can I update all those images with one image?
so the result will be:
image4

Basically,I need a function that deletes all old rows,then allow new inserts.If i delete,the ad_id reference to 3 images is lost and only inserts1 image instead of 3

I tried REPLACE,but it only inserted a fourth new row(may be i need an advanced REPLACE or some special INSERT approach !!!?)

Any help would be very much appreciated !
my gratitude in advance.
Dec 28 '07 #1
0 1141

Sign in to post your reply or Sign up for a free account.

Similar topics

2
10650
by: scott | last post by:
Hi, I'm having some trouble with something that should be relatively easy. I want to update multiple rows in one of my database tables simultaneously. In my table I have these values: imageID image_order I want to be able to modify the image_order column where imageID = imageID.
10
9938
by: IWP506 | last post by:
Hello everyone. I have a header picture for my website with text on it like "Home" "links" "about" etc. It's all 1 picture. I've seen people's sites where they have 1 picture but somehow make only portions of it a link. My question is is there any way to make a section point to 1 page, another sectioni to another page, etc, or do i need to make seperate images and try to piece them together. I'm using frontpage 2000
0
2703
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main form. Then I have 3 pages on a tab control ( 4 if the type of candidate validates that is is to be shown) Each page has a subform. The subforms can be either single or continuous, I think I am still deciding what I want to lock down this entry...
3
3488
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. -Regards Arun
1
2173
by: FuzzyLogik | last post by:
I need the image to be in the CSS, because I plan to have multple stylesheets. The tricky part is I have 3 parts to the image, a top, the main bit, and right, Here is the image: http://uplued.com/waffleimages/files/cb/cbbfce5e6067c8e770cf5e964a3dffd0cb65c0df.gif Unless you can think of a way for me to have it all in one graphic and have transparency? I'm not sure.
1
1361
by: zags | last post by:
I've tried a couple suggestions on this, but so far I still can't figure out an efficient way to do this. Hopefully someone can help me out. I have an access db that uses tables from an ERP db in Oracle connected via ODBC. I need to give a user a .csv file that contains a summary of payroll data over an extended period of time, i.e. 2 yrs. The difficulty I'm having is that the user wants all the data in one .csv file, this can equate...
2
2646
by: julie18881 | last post by:
I may be being really stupid here, i have spent the last 3 hours looking round your site and some other for answers to my problem, but have not had much luck (possibly cuase my brain just isn't working today) I have EasyPHP2.0b1 Apache/MySQL server installed on my Windows XP(SP2) machine. This runs Apache 2.2.3, MySQL 5.0.27 and PHP 5.2.0 I have a PHP code filled listbox, which allows multiple selections. Actual Values are "rcd_no, cn_no"...
11
4170
by: Jankie | last post by:
I need to dispaly a user's multiple images in one entry.Right now,say if a user uploads 3 images,three entries for the same id display to match 3 images. I only want 1 entry to display all of a user's related images like below: Id First Name Last Name Title Image1 Image2 Image3
5
5353
by: rosaryshop | last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php. As the user makes selections, it updates images of various parts, giving them a preview of the finished item. The preview resides within a div and is simply a series of <br>-separated images. Simple html. The system is working fine with FireFox and Safari, but some MSIE 6 and 7 users are reporting that only the first image is updating and the...
0
9499
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4076
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2898
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.