473,799 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1138
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
1677
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
1878
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 = eval("document.imageForm.move" + ""); alert(moveElement); if (document.imageForm.select_all.checked) {
3
15719
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 loop? Thanks.
1
1675
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, it will show the picture on the page ? Do i need to use java script for that ? TQ in advance for any help.
4
1610
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 selected hours (say from 8:00am till 1:00pm) appear highlighted or shaded (like in MS Outlook expres). Any help will be appreciated --
1
1708
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 the field in the db in not null and it have this value <Binary> . but when i try to select it in gives me this error "An unhandled data type was encountered". this is my code : To insert the image sql="insert into users_img (user_image,user_id)...
5
7788
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 it wasn't working. Reading through the MSDN to find out why, I ran across the following: "The PictureBox is not a selectable control, which means that it cannot receive input focus." This obviously puts a damper on the project. Is there any...
1
2080
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 2 2 ../../media/images/tester/oakVilla.jpg 3 2 ../../media/images/tester/oakVilla2.jpg 4 2 ../../media/images/tester/oakVilla2.jpg 5 1 ../../media/images/the villa/image2jpg
1
3132
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 each attempt and it should be easy, but it's not. I have simplified the app drastically by just having a datagrid being populated with the names of images from an array, which was populated via LoadVars. From there, I want to click on one of the...
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
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
10485
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10252
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...
1
10231
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7565
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
6805
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
5463
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...
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.