Topic: PHP/MySQL syntax problems
I had this leftover from a previous login script:
$query = "SELECT * FROM users WHERE username = '" . $pun_user['username'] . "' ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
It doesn't work anymore now that I've brought the page into PunBB.
How does PunBB connect to the database to get some data about the user that's logged in? I couldn't find good examples within the code. I'm guessing it should be something like this:
$result = $db->query('SELECT * FROM users WHERE username = $pun_user['username']') or error('Database error', $db->error());
$row = mysql_fetch_array($result);
But I can't even get the syntax right. Keep getting errors. Don't know how to find the answer using Google either.
Can anyone help?