473,396 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

selecting 3 images

Hi all,

I am not very good at sql, so anything remotely beyond simple, it goes
over my head.

I have a table which contains various fields, including 3 image fields.
(image1_id, image2_id, image3_id). Each of these fields contains the id
of an image found in the images table, (id, image).

I need to pull all three images out and use them, which is where I get
stuck. To use just one image, I use the following:

SELECT " . DB_PREFIX . "news.id, tagline, article, image
FROM " . DB_PREFIX . "news
LEFT JOIN " . DB_PREFIX . "images
ON image1_id = " . DB_PREFIX . "images.id
WHERE main='on' LIMIT 1

and I am able to refer to the image as image. But how do I pull out all
three to use them? I hope this is clear enough, let me know if you need
any mor information.

Thanks

Patrick

Jan 10 '06 #1
3 1122
This is the easiest one

select a.*
from images a,
news b
where a.id in (b.id_1, b.id_2, b.id_3)

You have to make it work for your database structure of course.

Jan 10 '06 #2
This is the easiest one

select a.*
from images a,
news b
where a.id in (b.id_1, b.id_2, b.id_3)

You have to make it work for your database structure of course.

Jan 10 '06 #3
hi thanks for that. but once i have that, how do i use the images? i
cant use image1_id, image2_id, image3_id, I need some way to refer to
the 3 images themselves dont i?

Jan 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Teeravee Sirinapasawasdee | last post by:
How can we select between .NET Framework 1.0 and .NET Framework 1.1 in Visual Studio .NET if we install both of them?
7
by: Phil Powell | last post by:
I am producing a form using PHP on the back end and Javascript on the front end. The resulting script will come to the browser as follows: <script> <!-- function selectAll() { moveElement =...
3
by: Bry | last post by:
I know you can select a single item in a list view using the following code listView.Items.Selected = true; Is it possible to do this for all items in the listView control without using a...
1
by: http://www.visual-basic-data-mining.net/forum | last post by:
I have a page where it requires user to upload an image file to the server. For the uploading, i am using HTML imput file control. Is there a way where after the user has selected a picture file,...
4
by: Dino M. Buljubasic | last post by:
I have a form that contains 24 user controls representing hours (something like MS Outlook daily calendar). I would like to be able to mouse-down-drag-mouse-up select a region of the form so that...
1
by: developers | last post by:
Hello Every One , I need Help in inserting the user image in my data base. but unfortunatly I don't know how.I'm using asp with sql server. I tried to insert the image and i geuss it worked.for...
5
by: Fao, Sean | last post by:
I'm working on a Windows application (VS 2005) that I will need to be able to select images I've added to a FlowLayoutPannel. I was attempting to select the various PictureBoxes and noticed that...
1
by: wildheart | last post by:
hi everyone, im new to thescripts and hope you can help ok this is what i have: Oracle table: ID PNumber URL 1 1 ../../media/images/the villa/image1.jpg...
1
by: Tarik Monem | last post by:
Hi Everyone, I've been trying to do this application that I've been working on from so many different angels and I seem to be running into some kind of wall with every attempt. I have scrapped...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.