Jump to content

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.