Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Sharing Data Across Multiple Sites


Sorry if this has been addressed on this board, but I am getting some serious Hour glass action, when I attempt to search this board.

I am attempting to put multiple sites together that utilize one common database with common tables. I wanted to get some advise on how the table can be implemented efficiently.

The concept is I have multiple sites that share the same code and database. I will assign a site ID to distinguish between the sites. Some Article data will be shared across the sites. Example: I have a site for Bass Guitar, Lead Guitar, Keyboard, Saxophone, etc. A component of the site will be articles written about music theory, that can span all these sites. How can I implement a solution that allows One article to be placed on all these sites based on the site ID.

I was thinking of one of two ways (and ofcourse there might be an even easier way, i haven't thought about)

Option 1
Having a field in the database named after each site or siteID, and in my query having a WHERE Clause in the code based on the siteID ie: "WHERE Bass = 1" for the bass site, and on the Saxophone site the same code would be there "WHERE Sax = 1" that way on each site If the article has a 1 in the field, it would display. I don't think it is efficient and if I where to use this concept across a large number of sites, it would very quickly become a nightmare to maintain.

Option 2
Having a field that receives a comma delimited data, that can be parsed with SQL and displaying the results if the data is present. With option two I do not know how to do it with SQL any insight? Is this efficient?




View Complete Forum Thread with Replies

Related Forum Messages:
Normalizing The Unknown - Multiple Sites Setup
This question is about whether to share common tables across multiple sites that share the same database.

Mainly, the 'Members' registration table along with others for run times, ad descriptions, payment processing etc.

Of course sharing the tables could simplify things (creating same queries across multiple sites, for example) BUT looking ahead toward the sites which are wholly undeveloped with fields not really known ..I am starting with one large US city site. Other sites will be one for Paris, France - not entirely sure of how common the fields might be at this point since I'm not certain how they do things in the French quarters! And a site for pilot training.

However all members/registrations will be signing up for a single purpose - they are placing paid-for advertising on the sites. So generally they are similiar -- at least for signup, though added tables may vary. Also, there is consumer oriented advertising and business geared ads. (different runtimes/pricing but I don't think this matters)

The sites may be split apart at some future point. So in this interest, to move the tables back apart -- I think it easier to keep any 'Members'/registration tables seperate, even though rowid's might be preserved in the moving.

The big advantage I see for sharing at least a Members table is keeping the rowid discreet and avoiding confusion. While it may create gaps in rows or structurally bind things if the sites on the database end up being split off into their own seperate databases.

What might be the deciding factors at this stage, murky as it is?

View Replies !
Sharing Data Across Two Databases
I am having trouble deciding how to best handle this situation. I have two separate applications each with their own database, but would like for them to share the same user account information. If a user registers for one application, they should also have an account on the other application.

Using views to share the same user table across both databases is not an option as I am using MySQL 4.

Any suggestions on how I should best handle this?

View Replies !
Best MYSQL Sites
i want to know the list of best Web sites were i can get MYSQL tutorials working with PHP.

View Replies !
Large Commercial Sites
For the past few months I have been learning PHP and MySQL in my free time. I have ideas for money making entrepreneur-style websites (worth a try, right? ). I'd like to develop the sites myself but I'm struggling to find resources that offer a straight up, detailed guide to creating high traffic database driven websites.

So far all the books I have bought come across as "here's a chapter on how to make x application, but in the real world it's much more complex". In other words, workaround solutions that wouldn't be suitable for ACTUAL high traffic db driven sites. I'm understanding the material fine, it just doesn't seem thorough enough for real world.

I'm contemplating buying Sitepoint's "Build Your Own Database Driven Website Using PHP & MySQL", but since each book I've bought costed $20-40 and so far none of them have been up to what I'd consider industry standard, I'm slightly reluctant to shell out another $40 at risk of getting rehashed version of the "watered down version of real world apps" style approach the other books had. Has anyone bought this book? Would you be able to develop a site like, say, IGN using the info in it?

Alternatively, if anybody can list a few key points that I can research (i.e. security issues, relational databases etc.) I'd be more than happy to go off and locate the articles myself. It's just knowing what I need to LEARN that's the problem.

View Replies !
Database Synchronisation On Two Remote Sites
I am considering the possibility of trying to keep a user table synchronised on two different sites. This is not something i've done before so i'm looking for any tips that might help me on my way.

Basically I was thinking of:

- scheduling php script to connect to both databases via cron to update the table at regular intervals
- generating an xml feed and doing the same thing

Both methods would potentially involve storing a pointer to only read and write the new rows, although perhaps I could use DATETIME to also copy accounts that have been updated since last run.

Probably biggest concern is:
- security... operating in a way that the data is private. The most sensitive data is hashed passwords and postal addresses, I don't think it would be appropriate to not somehow protect this info during transfers. I'm not sure whether SSL is an option (should be) but possibly I was thinking of creating some kind of token system.

- bandwidth. both sites should be fine resource wise but due to my lack of experience in these matters I don't really know what the performance hit will be, and I would like to run the script very often

As far as I know alot of big sites (for example hotel booking engines) use xml in the background to share info but I really have no idea how it all works.

View Replies !
Connecting To Yahoo Webhosting MySQL Sites
1. I've signed up for yahoo webhosting because they had MySQL
2. Installed their phpadmin tools and setup the admin username / password for my db's, create one db and table
3. I downloaded and installd the MySQL GUI tools
4. Pointed MySQL admin to my domain name with un/pw default port 3306

And all I get is "Can't connect to MySQL server on domain name (10060)

View Replies !
Two Sites Using The Same Forum Database User List
I know it's possible for TWO different sites to use the same database. Let me explain.

I have siteA and it runs a forum. Through the site, users of the forum can login using their forum ID. I now create siteB on a different domain, but on the same hosting service. I want users from siteA to be able to login with their name from that site on siteB. How would I do this? I'm using myBB as my forum software.

View Replies !
Configure 2 Sites To Access One User Table
I have two databases on the same server with different domains. I would like both sites to access the same user database table. They have the same fields.

I thought that it might just be done with an mysql command, which will point one table to the other.

View Replies !
Sharing Table
Is it possible to share a single table between two databases? For example, I want a single seller table common to a database about houses for sale and a separate database about land for sale.

View Replies !
TABLE SHARING
i need to share a table between SQL Server 2005 DB and MySql DB. the table is on on SQL Server 2005 DB and i want "watch" it in MySQL DB.

View Replies !
Sharing A Database Between Two Servers
I have 2 harddrives, one with linux and windows, and the other holds all my php and sql databases. I set up the databases with windows and everything is fine. Now I want to be able to just have the linux version of mysql look at that same database on the second harddrive and work with the database. The error I get is "Can't open file:

'**.ibd' (errno: 1): "** being any of my tables. Is it possible to configure them to work together in anyway? I dont want to manually have to dump the database and then reload it every time i switch between the OSs... any suggestions?

View Replies !
Sharing Login Details
There is no decent image gallery that can be put with Joomla or Mambo CMS so I am wanting to add a separate pop up page to use a 4images (http://4homepages.de) image gallery.

HOWEVER,

I don't want my users to log in twice to two different databases!

I'm sure there is a way of doing this. (both the CMS and the Gallery are on the same server, and they can both use the same Database.

View Replies !
Sharing A MYSQL Database
I tried searching for information, but didnt exactly know where to look, meaning which keywords. I did try though hehe

I have a site (or am building) that hosts free accounts for stop motion projects. Now I am developing a script so that everybody can upload movies and stuff to their own account ( which is a subdomain name with their own database and stuff). I want that database to be one main database. I could of course set up a new database and tables for each account, but that would be VERY time consuming... (unless anybody knows an automic way of doing it.)

My question is:

How can I create a script that can be put on their site, but accesses the database of the main site. I cant just put the username and password in a config.inc.php file on each site, cause then they can all access MY database and fool around with it.

View Replies !
Entities Sharing A Look Up Table.
I have created a "country" lookup table, and I have two different entities that both have a "country" field in their respective tables. My question is this:

Are there any disadvantages in having two seperate entities pick up their relevant countryname from the same country look-up table? Is it even allowed? And lastly, as the country table doesnt contain any other fields, the country field acts as a primary key on it's own, correct?

View Replies !
Sharing Database Tables Between Windows & Linux
I'm new to MySQL (using v4.1) and have a dual boot machine with Windows and Debian Linux (Etch).

My goal is to share a table named "wordpress" between Linux and Windows by storing it on a FAT32 mount (I realise this limits me to 4GB in total).

From what I can see at the moment, the "wordpress" tables live under /var/lib/mysql/wordpress.

Numerous searches have revealed how to backup data, but I haven't seen any clues on how to permanently reloate a database to another location.

View Replies !
Sharing MySQL Install Between Multiboot Machines (windows)
On Windows, I multiboot W2k, WXP. All 2 have MySQL install but in different
directories and partitions. I (unfortunately) also have 2 instances of one database.

Is there a way for MySQL to share a common installation and database?

I suppose it is possible. If so, and if I install MySQL in W2K first, what are the steps to
import the database install into XP?
Will I need to install in XP again, and just import the databases? Or just create a
windows shortcut to database directory so it's automaticaly imported into XP MySQL?

View Replies !
Multiple Data
Is there any way of storing multiple data in 1 mysql field and seperate it with commas like...
word 1, this, another thing, 4th thing, hello
etc, and that would all be in 1 mysql field, and you could be able to pull out each word seperatly?

View Replies !
Multiple Data Folders
I am currently running out of space on one of my database servers. Is
it possible to move the relevant files for tables onto another drive
and instuct MySql to use both folders for it's data?

So basically can you have mulitple data folders setup and if so how is
this configured?

On another note I could delete some of the older data but the database
does not seem to reduce in size after my delete queries. How do I go
about truncating the database to free this space physically?

View Replies !
Get Data From Multiple Tables
I have three tables: PRICES_2006, PRICES_2007 and PRICES_2008
I want to find all the rows between certain dates and then order them by date (TIMESTAMP).

My current code looks like this: .......

View Replies !
Data From Multiple Tables
I am working on a website about sea shells and basically I have 3 tables:

- shell_tb; (table of shells)
- site_tb; (sites where they can be found)
- instrmt_tb; (instruments used for it)

As you may already have guessed there are two columns in shell_tb (site and inst) which may use more than one item from the site_tb and instrmt_tb.
1st. How do I configure the columns in shell_tb in order to accept more than one value?
(I tried:

CREATE TABLE shell_tb (
shell_id INT(1) NOT NULL AUTO_INCREMENT,
shell_name CHAR(40) NOT NULL,
site INT(20) NOT NULL,
inst INT(20) NOT NULL,
PRIMARY KEY (shell_id)
) TYPE=MyISAM;

but no luck at all when inserting more than on value into inst column.) 2nd. How do I retrieve the info from there?

View Replies !
Multiple Data Sets
How can I select which data set (result set) the stored procedure produce if
there are more than one select statement in the code. Ex.

[1] select petname from pets where kind="dog"
[2] select petname from pets where kind="cat"

can I select from either statement [1] or statement [2] for the output result set?

View Replies !
Multiple Data Directories.
Is it possible to have different data directories for different databases. Not just different subdirectories of the parent directory but data located in completely different locations (say a different drive for instance).

View Replies !
Select Data Multiple Tables
I would like to SELECT information out of around 100 tables. The thing is I would like to avoid typing all those 100 names manually....

View Replies !
Insert Data Into Multiple Tables
Is it possible to insert data into multiple tables with one insert statement?

View Replies !
Select Multiple Data From One Cell
Sorry if I don't know how to word this using the correct terminology.

I have a field called "class" and in this class I want to add one or more bits of data. Example: P6/1, P6/2, P6/3, M1/1, M1/2 etc... I want to query the DB and select the row if it finds a specific class.
Something like this: SELECT * FROM file WHERE class ='P6/3'.

View Replies !
Selecting Data From Multiple Tables
I have three related tables. tv_observersation, which contains stationID with the start time and end time for a tv station program viewed (the stationID isn't a key field as the same station can be viewed different times). A stations table, which contains the stationID and the station_Name, and an advertisement table, which contains a list of advertiserID and which stationID they are subscribed too (a one to many table).

I am trying to generate a query, that would take out info i.e, the info from only stations that a specific advertiser has subscribed to in the advertisment table, but I am getting duplicate info in the query results from the observations table for a specific table. I think it may be a problem with how I am using the select statement. Do I want to select from two tables observations, stations like I am below, or should I use the other two (stations, and advertisments) with the inner join statement.

The objective is to retrieve only the stations that a advertiser is subscribed to from the observations table. Code:

View Replies !
Retrieve Data From Multiple Tables
I have multiple tables I'd like to retrieve data from using the same query statment.
All tables are setup as follows:

ID
Reference
Value
Timestamp

I would like to select all the data from "table1" and "table2" where there timestamp is between Jan 01 2005 9:00:00 am till Jan 02 2005 16:00:00

Is this possible?

View Replies !
Comparing Data In Multiple Table
In my db I have multiple tables, which are versions of the same table from different days. I import the data daily by renaming the old table to table_name_date and then importing the new data into a freshly created empty table. This gives me the following tables:

mysql> show tables;
+-------------------+
| Tables_in_mydb |
+-------------------+
| custinfo |
| custinfo_0206 |
| custinfo_0207 |
+-------------------+

The columns are obviously the same in each table:
mysql> describe custinfo;
+-------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | | |
| x | int(11) | NO | | | |
| y | int(11) | NO | | | |
+-------------+---------------+------+-----+---------+-------+

what I woud like to do is to query all "x" from each of the tables and compare them. I can obviously query for "x" in custinfo and then for "x" in custinfo_0207 and compare them, but can I do this in one query?

Ideally what I would get is something like that
+-------------+---------------+--------------+-----------------+
| Field | custinfo_0206 | custinfo_0206 | custinfo_0207
+-------------+---------------+--------------+-----------------+
| id | 1 | 1 | 1 |
| x | 5 | 4 | 2 |
| y | 150 | 150 | 135 |
+-------------+---------------+------+-----+---------+-------+

Is that possible?

View Replies !
Getting Data Out Of Multiple Tables And Join
I have two separate querys, but what I want to do is make one query from it. To get data from different tables. Code:

View Replies !
Select Data From Multiple Tables
I am trying to use the select statement to select data from multiple tables withing my database. could someone post me an example of how the code would look.

if you could use the following info in the string the would be great.

I want to selsect the following info....

View Replies !
Search Multiple Tables With Same Data
I have 3 tables where Product col is the same across all 3.

Tables
id /Product / Price

So far I have been using
$query = "Select `product`, `price` as p, 'tbl1' as n from `tbl1` where `product` REGEXP '".$trimmed."'
UNION ALL
Select `product`, `price` as p, 'tbl2' as n from `tbl2` where `product` REGEXP '".$trimmed."'
UNION ALL
Select `product`, `price` as p, 'tbl3' as n from `tbl3` where `product` REGEXP '".$trimmed."' ORDER by `name`";

Output gives me
Product | vendor | Price

Wanting to do a search where product is combine from all 3 tables and prices in different colums - >output

Product | Price (tbl1) | Price (tbl2) | Price (tbl3)

Any idea's ?

View Replies !
Insert Data Into 10 Multiple Tables
Can I insert data into multiple tables at once? Basically just need to insert a number into the 'membersID' column into 10 tables, but is taking ages, so wondering if I can write a query which targets all the tables or is this impossible in SQL?

View Replies !
How To Pull Data From Multiple Tables
I have a db, with several tables in it, I have now reached to the point where I need to pull data from several tables. What is the best way to do this?

Should I put a column in each table, and then insert a unique key in all of them at the time the record(row) is being created? If this is the way to do it, when I am putting the unique key in each table would I just do an insert in each of the tables?

View Replies !
Pull Data From Multiple Tables
Can you pull data from 2 tables in the same database onto the same page? What about more than 2 tables?

Here is my dilema: I currently have a database with 1 table, and a ton of rows. The information is property information, and each property has multiple empty suites. As of now, I have columns for Building Name, Address, and then columns for Unit Type A (for the first unit), Rent A, Type B, Rent B, etc....

I was wondering if I would be able to put the listings we have into thier own property table, and then one bigger table of all the properties individual information. Keep in mind I need to call all tables together on my portfolio pages, so I would be connecting to quite a few tables at once.

Or my other option I was thinking about was to just have 2 tables: 1 Buildings info, and 1 units info.

Which of these would you do, or how would you organize this data.

View Replies !
Inserting Data Into Multiple Tables
I am just learning both MySQL and PHP, and have a question about a project I am working on. The first (and main) table for this project has the basic information about an refund request, including an autoincrement unique ID. Another table includes the products and uses the ID as a reference. The third table is the history of everything that happens to the request. For example, the information may be as follows.

Credit table
ID - autoincrement
status - requested, needs authorization, processed, etc
agent - who entered the request
customer - person requesting the refund
other customer info
order table
ID - reference to Credit table
Item - item ID for amount requested
quantity - number purchased
price - price of each item
(total information is calculated on above fields)
history table
ID - reference to credit table
seq - id for each history log
old status - the previous status
new status- the status after the update to the record
agent - agent making the change
notes - a description of what was done.

I have the PHP form that collects the data to be entered. My question is, since the first table is an autoincrement, what is the best way to insert a record into the Credit table, pull the ID that was just entered into the credit table and insert that ID into the order and history tables?

View Replies !
Adding Up Data From Multiple Rows?
If I have numerical information stored in different rows what is the best method to find the sum of all the numerical information in the rows?

View Replies !
Append The Data In Multiple Rows To Single Row
i need a query to format the data

the raw data is as follows

ID skills

1001 sql

1001 C++

1001 java

1002 unix

1002 C++

1003 rdbms

1003 java


and the result must be

ID skills

1001 sql , C++, java

1002 unix , C++

1003 rdbms , java

View Replies !
Get Data From Multiple Tables And Then Order By Field
$QueryHIST_QUOTES = "
SELECT TIMEDIFF(TIMESTAMP, $starttime) AS diff, t.* FROM $currentTable t
WHERE TIMESTAMP BETWEEN $starttime AND $endtime
ORDER BY TIMESTAMP";

Originally I had the variable $currentTable = "PRICES_2008" but I now want to get rows from multiple tables, so I tried:

$currentTable = "XAUUSDOZ_2003 XAUUSDOZ_2004 XAUUSDOZ_2005 XAUUSDOZ_2006 XAUUSDOZ_2007";

View Replies !
Update One Table With Data From Another That Has Multiple Returns
I have a query that works but it takes extraordinary amounts of time to run and I'm sure there's got to be a better way. I haven't touched sql in many years and I just can't remember the proper way to do this.

Table 1 has a column that I need to fill from table 2. Table 2 has multiples of the requested data. There are about 303 records in table2 that meet the >0 criteria but only 44 distinct values that I need to retrieve. col1 in both tables is the matching index.

What I have so far is:

update table1 a set a.col2 = (select b.col2 from table2 b where a.col1=b.col1 and b.col2>0 group by b.col1)

I also tried limit 1 instead of group by but there was no difference in execution time (which is about 5 updates in 10 minutes!)

View Replies !
Check For One Piece Of Data In Multiple Rows.
I have a table: (arbitrary names bellow)

main_id
info
info
info
id1
id2
id3
id4
id5
id6
id7
id8
id9
info

----
id1-4 will always have info 5-9 may be null. I need to do a select that will find if certain data is in id1-9 and return all rows where this matches.

SELECT *
FROM `recipes`
WHERE id1 =1032 OR id2 =1032 OR id3 =1032 OR id4 =1032 OR id5 =1032 OR id5 =1032 OR id6 =1032 OR id8 =1032 OR id9 =1032
ORDER BY class LIMIT 0 , 30

is a bit cumbersome. is there a better way to do this query?

Also... I am not concerned about speed when row is added to a table, but want speed when this query is made. is there a good index structure to make? And if data is already in, is there a way to make it re-index the table?

View Replies !
LOAD DATA INFILE - Multiple Tables
Is it possible to insert into multiple tables with a LOAD DATA INFILE statement? I'm going to receive a text file with many fields, and then all of these fields need to be imported into the correct tables. It seems as if LOAD DATA can only insert into one table at a time.

View Replies !
Complex - Extracting Data From Multiple Tables - Plz Help
I have spent more than 24 hours now just trying to build a query to extract data from multiple tables (which are a bit typical) in the format I need but in vain and I am goin MAD now . Any help would be really apprecaited.

I have 5 tables: items, table1, table2, table3, and table4

table1, table2, table3, and table4 have got 368 columns each (366 representing each day of a year plus two additional columns - see below in structures)

structures are as follows:

items: ITEMID, TITLE, DESC ...

table1: ITEMID P1JAN01, P1JAN02, ... P1JAN31, P1FEB01, P1FEB02, ...P1FEB29 ... P1DEC01, P1DEC02 ... P1DEC31, YEAR

table2: ITEMID P2JAN01, P2JAN02, ... P2JAN31, P2FEB01, P2FEB02, ...P2FEB29 ... P2DEC01, P2DEC02 ... P2DEC31, YEAR

table3: ITEMID P3JAN01, P3JAN02, ... P3JAN31, P3FEB01, P3FEB02, ...P3FEB29 ... P3DEC01, P3DEC02 ... P3DEC31, YEAR

table4: ITEMID P4JAN01, P4JAN02, ... P4JAN31, P4FEB01, P4FEB02, ...P4FEB29 ... P4DEC01, P4DEC02 ... P4DEC31, YEAR

Yes they are funny but that's the way they are.

Note: Please note the month names within the column names

Now I need to select SUM of a given month (say JAN) for a particular ITEMID from each of the tables for a given year (say 2006)

for SUM i am using:


PHP

$p1 = "P1JAN01 + P1JAN02 + P1JAN03 + ... P1DEC31"
$p2 = "P2JAN01 + P2JAN02 + P2JAN03 + ... P2DEC31"
$p3 = "P3JAN01 + P3JAN02 + P3JAN03 + ... P3DEC31"
$p4 = "P4JAN01 + P4JAN02 + P4JAN03 + ... P4DEC31"

and then

SELECT $p1, $p2, $p3, $p4 ...


A basic query that I first tried was:


PHP

SELECT
$p1 AS P1,
$p2 AS P2,
$p3 AS P3,
$p4 AS P4
FROM items
LEFT JOIN table1 on table1.ITEMID = items.ITEMID
LEFT JOIN table2 on table2.ITEMID = items.ITEMID
LEFT JOIN table3 on table3.ITEMID = items.ITEMID
LEFT JOIN table4 on table4.ITEMID = items.ITEMID

WHERE

table1.YEAR = 2006 &&
table2.YEAR = 2006 &&
table3.YEAR = 2006 &&
table4.YEAR = 2006


This acts very funny...fetches me only the results which have got entries in all the tables. If there's no entry in any of the tables for a given item then that item is not fetched at all.

The result set i need is something like this

PHP

ITEMID        P1      P2       P3        P4
1            NULL     56       63      NULL
2             36        0     1253     63
3            NULL    NULL     NULL     NULL


and so on...

and these all must be for a given year

I tried playing around with the query with different joins and work arounds but no use. I really need this done soon. I'll be really thankful if you can suggest me anythig that can get me the result set i need. Please let me know if I am not clear anywhere.



View Replies !
Preventing Multiple Users From Corrupting Your Data
I'm looking for some advice on how to best prevent my data from getting confused in the event that I have multiple people using my website at the same time.

I'm using PHP 5 to interface with MYSQL 5.

I need to have the webguest account perform an insert on two tables, in two separate queries that occur in the same batch of code (same mysql connection). I need to be able to identify entries that came from the same user in the two different tables (last_insert_id() written to the second table). I don't want the data getting crossed if two users are performing inserts at nearly the same time.

My question is, what is the common practice to solve this problem? If I use LOCK TABLES, are there problems with the table getting left locked by the users (computer crash, network outage etc)? If the table is locked and another user tries to access it how can I have the PHP code wait and try to access again after a couple seconds? Or can I just limit the number of consecutive logins with the webguest account to 1?

View Replies !
Most Efficient Way Of Storing Data From Multiple Accounts
As part of a system I am putting together I need to allow users to create thier own accounts on my servers. Each user can create their own account, and then have their users register for it. Each account needs it data seperate from the others, a member registered for one account should not be able to view another account and a username registered with one account should still be available to the other accounts.

The ways I have been looking at are:

1. Create a new database for every account created so that all users are kept in seperate databases.

2. Have one table for users, one for topics, one for posts etc and then associate each row within this table with the relevent account. So for example a user could register with the forum with the ID 4, so their user entry would be

Userid: 234
Username: xxxx
Password: xxxx
Forumid: 4

Then when a new member registers with any account I simply check that there is not another user with the same account ID and username. Indexes on relevent fields in this system could help speed up huge tables.

I expect to quickly have 20,000 plus accounts (and in theory it could go up to hundreds of thousands).

I guess my question is which of these methods is better from a speed point of view once we get a large number of accounts and users. Also, are there restrictions on the number of fields in a table that could cause problems?

Using MySQL by the way, on an Apache server.

View Replies !
Self Join (?) To Get Data For Multiple Users From One Table
I am trying to generate a report containing ebay feedback scores for multiple users. Here is the database structure for the table that contains the scores:

TABLE: feedback

identities_id int(10) <- contains the user id which is stored in another table
feedback int(10) <- contains the feedback score for a specific date and time
date_recorded datetime <- date the feedback was captured
I need to get the feedback scores for let's say two users (I will want up to five but I figure the query will be almost the same) over a thirty day period. Here is the query I have created thus far (which does not return the correct results):

mysql
SELECT user1.feedback AS user1feedback
        , user2.feedback AS user2feedback
        , UNIX_TIMESTAMP(user1.date_recorded) AS date_recorded
     FROM feedback as user1
LEFT JOIN feedback as user2 ON user1.date_recorded = user2.date_recorded
    WHERE user1.identities_id = 1
       OR user2.identities_id = 2
      AND user1.date_recorded > NOW() - INTERVAL 30 DAY
 ORDER BY date_recorded ASC

This returns virtually the same data for both users which means I am not distinguishing the two properly.

View Replies !
Entering Form Data Into Multiple Tables
I've got a two tables in my database: "customers" and "orders."

I want to insert information from a form into both of them - in some cases identical information will need to be inserted into both.

The other twist is that I'd like to insert the automatically generated id customer 'id' value into the orders table.

I've tried using joins. Something like:

PHP Code:

INSERT INTO orders,customers (customers.id, customers.first_name, orders.del_address   .....)

View Replies !
Multiple Instances :: Pointing To The Same Data Files/the Same Database?
I think I know the answer to this question, but is it possible and safe to have multiple instances of MySQL pointing to the same data files/the same database?

I'm guessing that because only one instance can lock the files at any time that this won't work, but some confirmation would be good. I checked the MySQL documentation, but didn't see anything.

View Replies !
Sorting By Same-data Fields From Multiple Tables *without* UNION
Is there anyway I can sort by two columns (which are the same datatype) from separate tables (whether selected via Table1, Table2... or by LEFT JOIN) without using UNION?

View Replies !
Would Like To Avoid Iterating Through Data And UPDATING Multiple Times
I've got product data that belongs to a category table. The business requirement is for the user to be allowed to update the order in which products appear in that category. There is a field called product.sequence for that very purpose.

I'm being given the product id's in order for each category.

Do I have to iterate through the data in PHP and UPDATE the table w/ many SQL statements, or is there one SQL statement where I can provide the list of products to update in order?

I've used MySQL user variables before (e.g. SELECT @m:=0;) but I don't see how I can use it here... Is what I want possible in one query?


View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved