Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-18-2008, 10:09 AM Selecting values
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Hi

1. I have a sql table called BUYERS

2. In one menu called CLIENTES where I do insert into that table, clientes name. This is no problem.

3. In other menu called BUSINESS I need to start to insert (NOT UPDATING) the first business movement of one of clients already in the DB BUYERS, For that I need to appear in a field of the php file all the client names in order to select the one that i'm interestead, instead of writing the full name again.

I hope you do undersatand what I mean.

thanks
josil is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-18-2008, 02:36 PM Re: Selecting values
Super Talker

Posts: 116
Name: Paul
Location: South Africa
Trades: 0
Sorry could you try to clarify, or give more information, from what I can make out you have a table named BUYERS, then within that table you have a field for CLIENTES, that the clients name gets inserted into, then you have second field in the same table named BUSINESS, in that field you want to place some other sort of information, this works correctly until the point when the same client needs to be inserted again, for some other transaction, instead of inserting a new row it updaes the initial row that has the same client name.

Is that correct.

In my honest opinion, even if I am not on the right track your database structure seems a tad flawed, and it will become chunky when it grows.
If I were you I would rather have 2 tables to store this data, table 1 should look like this

Table 1's Name: Client_Info
Field 1: Client_id - This should be a primary key, and should be unique
Field 2: Client_Name

Table 2's Name: Business
Field 1: Bus_id - This should be a primary Key and Unigue, maybe even an auto increment field

Field 2: Transaction
Field 3: Client_id - This should be a foreign key that links the two tables together

This type of database design is called relational, the advantage is that everything is unique so nothing will ever overwrite, secondly it will not have duplicate data, example, you could have a single client with an id of "1", this will link to your second tables client_id field that will also be "1", if the same client has a secont transaction, it will be "1" again but it will be a different id, so it is not a duplicate.

When you want to query your data, all you need do is ask the db for a client name from table 1 where the client_id is equal to the second tables clint id, this way it will show you every transaction for that single client, etc

If this helps give me some Talkupation!
scorpioserve is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Selecting values
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22363 seconds with 12 queries