View Single Post
Old 03-06-2013, 09:54 PM   PM User | #16
bemore
New Coder

 
Join Date: Feb 2013
Posts: 39
Thanks: 14
Thanked 0 Times in 0 Posts
bemore is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
I have to say, this strikes me as indicative of bad DB design:
Code:
    $tbl_name = 'yourtable'; 
    $sql="INSERT INTO $tbl_name (gamename, gamecode, region, mode, vmc, smb, hdd, usb, notes, comp) 
        VALUES  ...
Why does the name of the table need to be a variable? Surely you don't have more than one table with the same fields??? Or did we discuss this before?
We've discussed this before
Though, I do have multiple tables now. I only ever UPDATE or INSERT into the one table, though, and I still have it set as a variable simply because that's what I did in my very first PHP/MySQL script so I just continue to do it that way. It could easily be INSERT INTO opl_comp, but why should it be? Honestly, I don't see any reason to assume bad DB design based off of calling a table with a variable, or not. I see no difference in the method or result no matter how it is done, and it'd all be personal opinion in the end.
bemore is offline   Reply With Quote