NightFalcon90909 Posted January 24, 2009 Share Posted January 24, 2009 Hey, this is a simple question. I searched the forum and the manuals and whatnot, and I'm sure its a simple answer, but I didn't find it anywhere. So if anyone had a free moment, I'd really appreciate it. Essentially, my science fair project is making a web based personal password generator/manager. I want to be able to store passwords in a table. I created a user with all privileges to a database called BetterPass. I successfully connected with that user to the BetterPass db. Know I would like to create a table, which should be named whatever my username is. Let $username = the desired username of the table. $query = 'CREATE TABLE $username ( ... ); creates a database name "$username", not the actual username. The question then, how can I get that table to be named whatever $username points to, and not actually "$username"? Thanks so much for your time! Link to comment https://forums.phpfreaks.com/topic/142275-solved-naming-table-with-user-input/ Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 single quotes do not parse variables. Double quotes will. $name = 'blah'; echo '$name'; // output: $name echo "$name"; // output: blah alternatively, you can jump in and out of the quotes to have php parse the var outside of the quote: $name = 'mud'; echo 'my name is ' . $name . ' i am blue'; // output: my name is mud i am blue Link to comment https://forums.phpfreaks.com/topic/142275-solved-naming-table-with-user-input/#findComment-745353 Share on other sites More sharing options...
NightFalcon90909 Posted January 24, 2009 Author Share Posted January 24, 2009 See I KNEW it would be something that would make me look breathtakingly ignorant. * sigh * Oh well... thanks so much! Link to comment https://forums.phpfreaks.com/topic/142275-solved-naming-table-with-user-input/#findComment-745359 Share on other sites More sharing options...
.josh Posted January 24, 2009 Share Posted January 24, 2009 btw, instead of creating a table for every user, you should instead have a single table with different columns, like username, password, etc... and insert/select/update/delete from a single table. Link to comment https://forums.phpfreaks.com/topic/142275-solved-naming-table-with-user-input/#findComment-745360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.