Jump to content

help getting started with a large db


glennn.php

Recommended Posts

i'm building a large db of Users who own more then one auto, for example. (LOTS more data, like various airlines they've used, etc. so there's more than one choice per user)

 

i'm hoping someone might give me an idea how best to create INSERT and SELECT queries for Users who might own an Acura Legend and a Chevy Camaro. i have these tables:

 

Makes with fields: ID, Make (contains many auto mfrs)

 

Models with fields: ID, MakeID and Model (contains the respective models)

 

Users ...

 

what i can't get around is how to store data where Smith owns an Acura (1)  Legend (5)(1) AND a Chevy Camaro - if someone helped me with a way to store this i could get the SELECT query myself.

 

i considered storing an array in the user's row, i.e. user_makes (1,3) and user_models (5,12) and working with those arrays when i retrieve the data, but i'm really thinking there's a better way to do that. i hate arrays...

 

i appreciate it much

 

GN

 

 

Link to comment
https://forums.phpfreaks.com/topic/202676-help-getting-started-with-a-large-db/
Share on other sites


$idMake = Mysql_result(mysqlquery("SELECT id from Makes WHERE Make = 'Acura';"));
$idModel = Mysql_result(mysqlquery("SELECT id from Models WHERE Make = 'Acura' AND Model='Legend';"));

$sql = "UPDATE assets (user, make, mode) VALUES ('John', $idMake, $idModel);"

something like above?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.