Heya, i made a script like this one
?
include ("./dbconnect.php");
mysql_select_db("tcb-data") or
die ("could not select database");
$FID = 20;
$result = mysql_query("SELECT * FROM ibf_posts WHERE forum_id=$FID");
while ($row = mysql_fetch_array($result))
{
?>
<a href=http://www.htmlforums.com/archive/index.php/"http://???????????.com/index.php?showtopic=<?=$row["topic_id"];?>"><?=$row["topic_id"];?> </a><br><?=$row["post"];?><br>
<?
}
mysql_free_result($result);
?>
The bold stuff i named it topic_id but when i call the script in mine browser i see the number of that topic.
I know in some other table topic_id is called tid, but how do i call that table to be shown at that bold space ??
Hop someone can help us
<?=$row["topic_id"];?>huh? why won't that print out the number? is that in the database in "ibf_posts"Ok its a forum, so those tables i didn`t make, and i want to call the subjet ot that topic and the posts of that topic on my main page
<a href=http://www.htmlforums.com/archive/index.php/"http://???????????.com/index.php?showtopic=<?=$row["topic_id"];?>"><b><?=$row["topic_id"];?></b> </a><br><?=$row["post"];?><br>
The bold stuff must be the subject name, but in the tabel where i call the post there isnt an "id" which generate the subject ["topic_id"] is the number of that topic so he knows where to link it to.
When i use this script i see
255 (this is the forum id)
bla bla bla (this is the post)
But 255 must be the title/subject of that topic and not a number.
I know in another table i got tid and that generate the title/subject of that topic.
So how can ik make like this
Max Payne (title)
bla bla bla (post)
So i got basicly 2 tables where i call info from it, how do i set this in a script.so you look at the table and find out what the subject is, so that means you need to open phpmyadmin and look at the table structure.I have 2 different tables in mine database where i need to call info from.
in 1 table there are the posts (see attach ibf_post)of that topic, and in the other one is the subject (see attach ibf_topics)
So i want to call "title" from ibf_topics and below i want to call "post" from ibf_posts.sorry i forgot one<a href=http://www.htmlforums.com/archive/index.php/"http://???????????.com/index.php?showtopic=<?=$row["topic_id"];?>"><?=$row["post_title"];?> </a><br><?=$row["post"];?><br>
you want post_title, not topic_idpost_title all info in tha colummn is NULLthen you have a problem as that should be the title of the post. look at a row that has info in it? which one is the title in?No row has that kind of info, but another table has it, thats mine question how can i call post from one table and call title from another table$result = mysql_query("SELECT * FROM ibf_posts, table2 WHERE ibf_posts.forum_id='$FID' AND ibf_posts.something=table2.whatever");
now you have to make sure that ibf_posts has something that is linking to the other table (table2 in my example)Hmm don`t get it.
$result = mysql_query("SELECT * FROM ibf_posts, table2 WHERE ibf_posts.forum_id='$FID' AND ibf_posts.something=table2.whatever");
This is your line,
i got table ibf_post in that table i got the "post"
and i got table ibf_topics in that table i got "title"
So i need to do
$result = mysql_query("SELECT * FROM ibf_posts, table2 WHERE ibf_posts.forum_id='$FID' AND ibf_topics.title=table2");no, read this part of the query.
ibf_posts.something=table2.whatever
ibf_posts has to have "something" in the structure that is linked to table2."somethingelse"
so basically I have
ibf_posts.something will equal whatever is in table2.somethingelse column.Like this...
$FID = 20;
$result = mysql_query("SELECT * FROM ibf_posts, ibf_topics WHERE ibf_posts.forum_id='$FID' AND ibf_posts.forum_id=ibf_topics.forum_id");
while ($row = mysql_fetch_array($result))
{
?>
<a href=http://www.htmlforums.com/archive/index.php/"http://forums.tcb-team.com/index.php?showtopic=<?=$row["topic_id"];?>"><?=$row["title"];?></a><br><?=$row["post"];?><br>
<?
}
mysql_free_result($result);
?>
Only 1 thing the title is getting repeated everytime, how do i solve that
becoz u see several replies, but u may only see the first post and then ther has to come another title with post
<!-- m --><a class="postlink" href="http://www.tcb-team.com/test/news.phpbecause">http://www.tcb-team.com/test/news.phpbecause</a><!-- m --> you are looping the whole thing. just loop the post and only show 1 instance of the title.Correct me if i am wrong
I want to loop the title, coz there is now only one topic in that table, so when ther is more it could be like this
Title
Post
Title
Post
Tilte
Post
And only the first post/topic may be shown, so i need to make sure that he loops the title and still have 1 post/topic instead of having them all(replies).
Do i need to set limit somewhere near post. just give me a clue so i can find myself a solution.if you set a limit in the query you will limit the posts as well. but you can group all of them by title if you want.
so try this
$result = mysql_query("SELECT * FROM ibf_posts, ibf_topics WHERE ibf_posts.forum_id='$FID' AND ibf_posts.forum_id=ibf_topics.forum_id GROUP BY title");
but it still will loop the title like it does now. but all of the posts will be together according to title.
you are still stuck with it looping the title unless you get it out of the loop.
you could do the query according to the forum_id and then lopp that and in that loop you can do another query to get the posts and loop the posts according to the title, then the nexct loop will be a different title and repeat the process.Ok i did put in group by title, i thought it worked, but now i have 2 news items and the title is different but by every title he post the post of the first title
Look at it :: <!-- m --><a class="postlink" href="http://www.tcb-team.com/test">http://www.tcb-team.com/test</a><!-- m -->
Do i need a query to make it work 100% goodie then there is somethign wrong with your query. what is the code now that you have.$result = mysql_query("SELECT * FROM ibf_posts , ibf_topics WHERE ibf_posts.forum_id='$FID' AND ibf_posts.forum_id=ibf_topics.forum_id GROUP by title");no, I want the whole thing, the query and the loop<?
include ("./connect.php");
mysql_select_db("****") or
die ("could not select database");
$FID = 20;
$result = mysql_query("SELECT * FROM ibf_posts , ibf_topics WHERE ibf_posts.forum_id='$FID' AND ibf_posts.forum_id=ibf_topics.forum_id");
while ($row = mysql_fetch_array($result))
{
?>
<a href=http://www.htmlforums.com/archive/index.php/"http://forums.tcb-team.com/index.php?showtopic=<?=$row["topic_id"];?>"><?=$row["title"];?></a><br><br><?=$row["post"];?><br><br><br>
<?
}
mysql_free_result($result);
?>
?
include ("./dbconnect.php");
mysql_select_db("tcb-data") or
die ("could not select database");
$FID = 20;
$result = mysql_query("SELECT * FROM ibf_posts WHERE forum_id=$FID");
while ($row = mysql_fetch_array($result))
{
?>
<a href=http://www.htmlforums.com/archive/index.php/"http://???????????.com/index.php?showtopic=<?=$row["topic_id"];?>"><?=$row["topic_id"];?> </a><br><?=$row["post"];?><br>
<?
}
mysql_free_result($result);
?>
The bold stuff i named it topic_id but when i call the script in mine browser i see the number of that topic.
I know in some other table topic_id is called tid, but how do i call that table to be shown at that bold space ??
Hop someone can help us
<?=$row["topic_id"];?>huh? why won't that print out the number? is that in the database in "ibf_posts"Ok its a forum, so those tables i didn`t make, and i want to call the subjet ot that topic and the posts of that topic on my main page
<a href=http://www.htmlforums.com/archive/index.php/"http://???????????.com/index.php?showtopic=<?=$row["topic_id"];?>"><b><?=$row["topic_id"];?></b> </a><br><?=$row["post"];?><br>
The bold stuff must be the subject name, but in the tabel where i call the post there isnt an "id" which generate the subject ["topic_id"] is the number of that topic so he knows where to link it to.
When i use this script i see
255 (this is the forum id)
bla bla bla (this is the post)
But 255 must be the title/subject of that topic and not a number.
I know in another table i got tid and that generate the title/subject of that topic.
So how can ik make like this
Max Payne (title)
bla bla bla (post)
So i got basicly 2 tables where i call info from it, how do i set this in a script.so you look at the table and find out what the subject is, so that means you need to open phpmyadmin and look at the table structure.I have 2 different tables in mine database where i need to call info from.
in 1 table there are the posts (see attach ibf_post)of that topic, and in the other one is the subject (see attach ibf_topics)
So i want to call "title" from ibf_topics and below i want to call "post" from ibf_posts.sorry i forgot one<a href=http://www.htmlforums.com/archive/index.php/"http://???????????.com/index.php?showtopic=<?=$row["topic_id"];?>"><?=$row["post_title"];?> </a><br><?=$row["post"];?><br>
you want post_title, not topic_idpost_title all info in tha colummn is NULLthen you have a problem as that should be the title of the post. look at a row that has info in it? which one is the title in?No row has that kind of info, but another table has it, thats mine question how can i call post from one table and call title from another table$result = mysql_query("SELECT * FROM ibf_posts, table2 WHERE ibf_posts.forum_id='$FID' AND ibf_posts.something=table2.whatever");
now you have to make sure that ibf_posts has something that is linking to the other table (table2 in my example)Hmm don`t get it.
$result = mysql_query("SELECT * FROM ibf_posts, table2 WHERE ibf_posts.forum_id='$FID' AND ibf_posts.something=table2.whatever");
This is your line,
i got table ibf_post in that table i got the "post"
and i got table ibf_topics in that table i got "title"
So i need to do
$result = mysql_query("SELECT * FROM ibf_posts, table2 WHERE ibf_posts.forum_id='$FID' AND ibf_topics.title=table2");no, read this part of the query.
ibf_posts.something=table2.whatever
ibf_posts has to have "something" in the structure that is linked to table2."somethingelse"
so basically I have
ibf_posts.something will equal whatever is in table2.somethingelse column.Like this...
$FID = 20;
$result = mysql_query("SELECT * FROM ibf_posts, ibf_topics WHERE ibf_posts.forum_id='$FID' AND ibf_posts.forum_id=ibf_topics.forum_id");
while ($row = mysql_fetch_array($result))
{
?>
<a href=http://www.htmlforums.com/archive/index.php/"http://forums.tcb-team.com/index.php?showtopic=<?=$row["topic_id"];?>"><?=$row["title"];?></a><br><?=$row["post"];?><br>
<?
}
mysql_free_result($result);
?>
Only 1 thing the title is getting repeated everytime, how do i solve that
becoz u see several replies, but u may only see the first post and then ther has to come another title with post
<!-- m --><a class="postlink" href="http://www.tcb-team.com/test/news.phpbecause">http://www.tcb-team.com/test/news.phpbecause</a><!-- m --> you are looping the whole thing. just loop the post and only show 1 instance of the title.Correct me if i am wrong
I want to loop the title, coz there is now only one topic in that table, so when ther is more it could be like this
Title
Post
Title
Post
Tilte
Post
And only the first post/topic may be shown, so i need to make sure that he loops the title and still have 1 post/topic instead of having them all(replies).
Do i need to set limit somewhere near post. just give me a clue so i can find myself a solution.if you set a limit in the query you will limit the posts as well. but you can group all of them by title if you want.
so try this
$result = mysql_query("SELECT * FROM ibf_posts, ibf_topics WHERE ibf_posts.forum_id='$FID' AND ibf_posts.forum_id=ibf_topics.forum_id GROUP BY title");
but it still will loop the title like it does now. but all of the posts will be together according to title.
you are still stuck with it looping the title unless you get it out of the loop.
you could do the query according to the forum_id and then lopp that and in that loop you can do another query to get the posts and loop the posts according to the title, then the nexct loop will be a different title and repeat the process.Ok i did put in group by title, i thought it worked, but now i have 2 news items and the title is different but by every title he post the post of the first title
Look at it :: <!-- m --><a class="postlink" href="http://www.tcb-team.com/test">http://www.tcb-team.com/test</a><!-- m -->
Do i need a query to make it work 100% goodie then there is somethign wrong with your query. what is the code now that you have.$result = mysql_query("SELECT * FROM ibf_posts , ibf_topics WHERE ibf_posts.forum_id='$FID' AND ibf_posts.forum_id=ibf_topics.forum_id GROUP by title");no, I want the whole thing, the query and the loop<?
include ("./connect.php");
mysql_select_db("****") or
die ("could not select database");
$FID = 20;
$result = mysql_query("SELECT * FROM ibf_posts , ibf_topics WHERE ibf_posts.forum_id='$FID' AND ibf_posts.forum_id=ibf_topics.forum_id");
while ($row = mysql_fetch_array($result))
{
?>
<a href=http://www.htmlforums.com/archive/index.php/"http://forums.tcb-team.com/index.php?showtopic=<?=$row["topic_id"];?>"><?=$row["title"];?></a><br><br><?=$row["post"];?><br><br><br>
<?
}
mysql_free_result($result);
?>