Hi,
I'm designing a PHP/MySQL site to manage a collection of books. I have so
far created the table and inserted some of the data, and created a web
interface to access that data. I have a couple of things I'd like to do
though, if anyone has ideas.
Firstly, I want to do subject searches. For
Flint Million wrote:
Now I want to be able to do a subject listing as well as a search. For
example, if I asked for a lsit of all subjects, I want something like:
Nonfiction (2)
PHP (1)
Technology (2)
Computers (1)
Programming (1)
History (1)
Linux (1)
In database design, I'd almost
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Flint Million wrote:
Good idea. OK so I'll create a new database with subject ID's. Now, back in
the primary database, how can I have multiple subjects assigned to one book?
Let's say I repeat my above example and we assign Nonfiction to 1,
Yes you're on the right track
Easiest practical way is as follows:
Your book listing table has a field named say: subject_id
Which is just a SMALLINT UNSIGNED column or something, that allows up to
2^16 sized integers, more than I think should be sufficient for a huge
list of subjects, an
Flint Million wrote:
Good idea. OK so I'll create a new database with subject ID's. Now,
back in
the primary database, how can I have multiple subjects assigned to one
book?
Let's say I repeat my above example and we assign Nonfiction to 1,
Technology to 4, and Linux to 5. I know I might be
I have various tables where a column is set to auto_increment in my
table structure. I have been using the following INSERT query format:
INSERT INTO table VALUES ('$auto_increment_variable','$variable_1',
'$variable_2')
and then in applications where I have needed to know the value of the
On Sun, 22 Jan 2006 15:08, Ron Piggott (PHP) wrote:
I have various tables where a column is set to auto_increment in my
table structure. I have been using the following INSERT query format:
INSERT INTO table VALUES ('$auto_increment_variable','$variable_1',
'$variable_2')
and then in
That is the function I was looking for. Thanks. Ron
On Sat, 2006-01-21 at 23:47 -0500, [EMAIL PROTECTED] wrote:
Try:
?php
mysql_query(INSERT INTO table VALUES ('$variable_1', '$variable_2'););
$auto_increment_variable = mysql_insert_id();
?
-TG
= = = Original message =