m's coming from my db?? help
Posted: Mon Jun 16, 2008 2:36 am
I'm hosting my own apache/mysql server for testing and learning PHP.
What I'm trying to do is use phpbb3 to input text into the forum and mysql db,
then print it on the index.php, however when I'm using the following code, all it prints is m.
What am I doing wrong here? As far as I understand it, the $SQL is the query, the $result is the command to query, and the $db_field sorts out the queried information in whichever way I want (mysql_fetch_array, mysql_fetch_assoc, mysql_result - I've tried all of these.)
I've got that much figured out (I think)...
But I really don't understand why this doesn't work. All the names everywhere should be good, I've triple checked them.
And all I get printed when i visit the page looks like this;
I'm still learning, and pretty much all on my own. I know basics of coding and html pretty well so I can look at something and understand it usually, but I don't know all the functions and such. I can't see why this doesn't work though. I'm wondering if it's not my code and it has something to do with the db...
Thanks a ton for any info provided.
What I'm trying to do is use phpbb3 to input text into the forum and mysql db,
then print it on the index.php, however when I'm using the following code, all it prints is m.
What am I doing wrong here? As far as I understand it, the $SQL is the query, the $result is the command to query, and the $db_field sorts out the queried information in whichever way I want (mysql_fetch_array, mysql_fetch_assoc, mysql_result - I've tried all of these.)
I've got that much figured out (I think)...
But I really don't understand why this doesn't work. All the names everywhere should be good, I've triple checked them.
Code: Select all
<?PHP
$user_name = "root";
$password = "";
$database = "phpbb3";
$server = "localhost";
mysql_connect($server, $user_name, $password);
$SQL = "SELECT post_time, poster_id, post_subject, post_text FROM phpbb_posts";
$result = "mysql_query($SQL)";
$db_field = "mysql_result($result)";
{
print $db_field['post_time'] . "<BR>";
print $db_field['poster_id'] . "<BR>";
print $db_field['post_subject'] . "<BR>";
}
?>Code: Select all
m
m
m
Thanks a ton for any info provided.