Hey, I'm pretty much a noob when it comes to php, I'm trying to (very slowly) code my own CMS for my site that runs off of our forums database (kind of a portal system). I figured out how to connect to a database, run a query, and then print the results of the query to my site, but When i tried turning that around and using querys from the results as variables I get errors. I don't really know why it won't work, but i'm figuring its a syntax error since the error i get when i run the script is this...
Parse error: parse error, unexpected T_STRING in /home/www/napjunk/content_retrieval.php on line 19
here is the code i have, I've documented it (for both my sake and yours..lol)
<?
// config stuff
$db_name='my_db';
$db_uname='my_user_name';
$db_pass='my_pass';
$db_host='my_db_host';
$website_address='my_site';
//connect to the database and then select the table
mysql_connect($db_host,$db_uname,$db_pass);
@mysql_select_db($db_name);
//Query to get stuff from phpbb_topics
$q0 = mysql_query("SELECT * FROM phpbb_topics WHERE forum_id=32 ORDER BY topic_time DESC LIMIT 0,2");
$phpbb_topics_db_array = mysql_fetch_array($q0);
$str_topic_id = $phpbb_topics_db_array['topic_id'];
//Query to get stuff from phpbb_posts
$q1 = mysql_query("SELECT * FROM phpbb_posts WHERE topic_id =". $str_topic_id . " ORDER BY post_time DESC LIMIT 0,2");
$phpbb_title_db_array = mysql_fetch_array($q1);
$str_cur_post = $phpbb_title_db_array['post_id'];
//Query to get stuff from phpbb_posts_text
$q2 = mysql_query("SELECT * FROM phpbb_posts_text WHERE post_id=". $str_cur_post ." ORDER BY post_time DESC LIMIT 0,2");
$phpbb_post_text_array = mysql_fetch_array($q2);
echo($post_text['post_subject'] . "<br><br>");
echo($post_text['post_text'] . "<br><br>");
echo("<a href=\"" . $website_address . "viewtopic.php?t=" . $phpbb_post_text_array['topic_id'] . "\">" . $phpbb_post_text_array['topic_title'] . "</a>");
?>
Edit: oh yeah, the script runs @ this url:
http://www.napjunk.net/content_retrieval.php