im starting out with databases. Funfun. a couple questions
i am just setting up a database that stores usernames and passwords. I was told to set my primary column to be auto_increment and called ID. is this necessary for such a table? I see how it might be in others...
i am saving user and pass like this:
mysql_query("INSERT INTO $mysql_table (name, pass)
or die('Query failed: ' . mysql_error());
i think that this is the simplest way. Its getting info from the database that is confusing.. Say i want to get the pass for a username. right now, im sending the query, saving the result to an array, and taking the first element.
$query = "SELECT pass FROM $mysql_table WHERE name = 'gameguy43'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$array = mysql_fetch_array($result, MYSQL_NUM);
is there a simpler way to do this?
3)If i want to make a new table (i believe i know the sql) do i still send the sq with the mysql_query() function?
4)I want to eventually make db-driven forums. Should i make a different table for each thread, each forum, or just put it all together with a bunch of columns? What if i want to make a seriesof photo albums? should i make a new table for each album's pics, or just stick them all in one and add ann "album" column? (I want these scripts to eventually be able to be administrated through an admin panel, so i will be making these tables and working with them on the fly)
umm, i guess thats it, im just beginning so expect more questions. Thank god i finally started learning this stuff, using the file system was SO INEFFICIENT!