Hi there,
I have a table with items in it.
Table contents are: id, title, text, combination
Each product has a few other products with
which it can be combined. In the 'combination'-
field is an array of 3 other id's the product
can be combined with. (e.g. 78-34-94)
When i run a query, i display 20 results / page,
so results are LIMIT-ed. How can i display 20
items with title, text, and then 3 links to
corresponding items in the 'combination' collumn.
The links have to be the titles of those other items.
Thanks in advance & greetings,
Knoak 7 1629
.oO(knoak) I have a table with items in it. Table contents are: id, title, text, combination
Each product has a few other products with which it can be combined. In the 'combination'- field is an array of 3 other id's the product can be combined with. (e.g. 78-34-94)
Broken design. Use another table for the combinations of products, don't
put multiple informations into a single field (keyword: normalization).
table products
--------------
ID
title
text
table combinations
------------------
productID
combinationID
For a product with the ID 42 and your three combinations with other
products there would be three records in the second table:
42, 78
42, 34
42, 94
When i run a query, i display 20 results / page, so results are LIMIT-ed. How can i display 20 items with title, text, and then 3 links to correspondin g items in the 'combination' collumn.
With your current design you would have to split the combination field
with PHP and send another query to the server to get the associated
records. With a better design you should be able to get all informations
with a single query.
Micha
Could you maybe explain a little bit more?
About how i would put this into reality?
Thanks!
knoak wrote: *Anyone* ? Please...
1. Try searching the Internet on things like database normalization
2. Go to the library and check out a book on database design
3. Buy a book on database design
No, I'm not being flippant. Database design is not something you can
learn in a few messages. There are a few ways to do it right - and a
million ways to do it wrong!
I noticed that Message-ID: <4q************ *************** *****@4ax.com>
from Michael Fesser contained the following: Each product has a few other products with which it can be combined. In the 'combination'- field is an array of 3 other id's the product can be combined with. (e.g. 78-34-94)
Broken design. Use another table for the combinations of products, don't put multiple informations into a single field (keyword: normalization).
Correctly normalising the data would be best but actually it would be
possible to do what he wants to do, provided he was consistent in the
way he stored the data. You would just explode the field into an array
and then produce the links from the array values.
$comb_id = explode("-", $myrow['combination']);
for ($i=0;$i<count( $comb_id);$i++) {
echo"<a href=\"lookuppa ge.php?id=".$co mb_id[$i]."\">Combinatio n
$i</a><br>\n";
}
Then in lookuppage.php use $_GET[id] as the basis of a query.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Thanks Geoff,
But wouldn't this mean i'd have to run a query for every result?
Trying to understand the solutions everyone's providing.
Knoak
I noticed that Message-ID:
<11************ *********@z14g2 000cwz.googlegr oups.com> from knoak
contained the following: Thanks Geoff,
But wouldn't this mean i'd have to run a query for every result?
Yep.
But databases are good at that.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: redneck_kiwi |
last post by:
Hi all:
I have a really weird problem. I am developing a customer catalog
system for my company and as such have delved into sessions for
authentication and access levels. So far, I have managed to get a
working system just about finished.
I am building an interface for our customer service folks to use to
manage registered customers and am seeing some weird behavior.
|
by: jwbeaty |
last post by:
Here's a weird one.
I'm running SQL Server 7 and when I run a backup something weird
happens. When I perform the backup via Enterprise Manager by right
clicking on the database I want to backup, I click on OK but no
progress blocks show up in the window showing you the status of the
backup. The completion window pops up saying that the DB has been
backed up. OK--Fine, maybe the backup is really quick. Then, through
Explorer, I look...
|
by: Jon Combe |
last post by:
I have created the following test SQL code to illustrate a real
problem I have with some SQL code.
CREATE TABLE JCTable ( CustomerName varchar(50) )
ALTER TABLE JCTable ADD CustomerNo int
INSERT INTO JCTable ( CustomerName , CustomerNo ) VALUES ( 'Jon Combe'
, 1 )
INSERT INTO JCTable ( CustomerName , CustomerNo ) VALUES ( 'Bill
Gates' , 1 )
UPDATE JCTable SET CustomerNo = 2 WHERE CustomerName = 'Jon Combe'
|
by: Dmitry Tkach |
last post by:
Hi, everybody!
Here is a weird problem, I ran into...
I have two huge (80 million rows each) tables (a and b), with id as a PK
on both of them and also an FK from b referencing a.
When I try to run a query like:
select * from a, b where a.id >= 7901288 and a.id=b.id limit 1;
The query takes *forever*.
|
by: Jeremy |
last post by:
I have written my own URL rewriter, and it was working fine until i moved
the re-writing code from App_BeginRequest to App_AuthorizeRequest.
Now I get a 404 (file not found) error whenever the request doesn't have a
query string. If I add a query string, it works fine. The really weird thing
is that when I turn tracing on, the 404 goes away! This is driving me
crazy. Here are some sample URLs:
(tracing enabled = False)
Rewritten...
| |
by: soup_or_power |
last post by:
I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
I can't seem to encrypt the number 227968199 because I tried several
times and also tried other numbers which work fine.
Here is a sample session:
mysqlcreate table `destest` (num varchar(17));
Query OK, 0 rows affected (0.04 sec)
|
by: Petulant |
last post by:
Hello~
Help Please~
I am new to Access, so am a little behind the learning curve. I have a query that I have been running for a while that has worked fine and now (with no changes) is throwing up weird characters(like little blocks) in the Item Note field.
(Note : don't know if this infomation is important the only other thing I can think of that has changed in the last month is the size of the database which is 456M and links to 3 other...
|
by: Henrootje |
last post by:
I have a problem which I do not understand........................
I have a split database. Tables in the backend on a networkdrive, all
other in frontend placed in %temp%
I have this form that is based on a query . This
query consists of one table and two queries , both of them joined to the table. It takes about three
seconds to load .
To improve performance I put the results of in .
|
by: Drupan c |
last post by:
Hello everybody
i have a weird question... if u guys have observed when we use
ms sql .. on the query box when we take the mouse pointer to the corner of a single line query it changes its positon so that the complete line can be selected when clicked , rather than dragging the mouse over the query to select the query..
at first i would like to know what is it called ?? n how do i achieve this in a fire fox...
|
by: antonopn |
last post by:
Hello there,
I have just faced a really weird problem with a query in SQL SERVER 2000.
I had a database with collation SQL_Latin1_General_CP1_CI_AS and converted it in a new database with collation Greek_CI_AI.
The conversion was absolutelly correct. Tables, views, sps, functions etc. where succesfully transfered into the new database. The new database is working fine, but I faced a problem with a "select-from-where-like" query.
I...
|
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...
| |
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,...
|
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...
|
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
| |
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |