Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-30-2004, 07:02 AM
XinG
Unregistered

Posts: n/a

"number" posted

on map db thingy u av "blah blah has so many things" right?
and on numorous other things too! i cant think of any atm!
BUT how do u do it? on the site im coding atm.. i wanna b able to put "blah blah has "number" comments ..."

?????????????
Reply With Quote
  #2  
Old 01-01-2005, 10:26 PM
BB/Mike
Unregistered

Posts: n/a

Assuming in a table you have 1 record/line for each map, then just use a mysql_num_rows query...

http://au.php.net/manual/en/function.mysql-num-rows.php
Reply With Quote
  #3  
Old 01-02-2005, 08:31 PM
XinG
Unregistered

Posts: n/a

ok.. well, ive messed around with that and the result is =
Happy new year has [Resource id #4] comments :: Post a Comment

HELP!
Reply With Quote
  #4  
Old 01-02-2005, 08:34 PM
XinG
Unregistered

Posts: n/a

k, cancel that! i av got a bit further now.. i have it reading out the total no. of comments! (6)
but i dont want total comments.. i want total comments PER ID!!!!!!
Reply With Quote
  #5  
Old 01-03-2005, 10:25 PM
PHP-Largo
Unregistered

Posts: n/a

here's what my script does for that on my news :


[code:1:9f68712c98] $result = mysql_query("SELECT * FROM news ORDER BY news_id DESC LIMIT 10");
//Make table & display data
//Put data in array also...
while($myrow=mysql_fetch_array($result)){
####here you go ... this is where the query is
$result2=mysql_query("SELECT * FROM comments WHERE news_id='$myrow[news_id]'");
$num_comments=mysql_num_rows($result2);
####I put the stuff in a variable
####To put in news below!
echo"
<table align=\"center\" border=\"0\" cellpadding=\"4\" style=\"border-collapse: collapse\"><tr><td><table align=\"center\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:

collapse\" width=\"96%\" id=\"AutoNumber8\" bordercolor=\"#FFFF00\"> <tr><td>$myrow[news_title] :: Posted by $myrow[news_author]</td></tr><tr><td>$myrow[news_content]< tr><td><a

href=\"news.php?cmd=post&id=$myrow[news_i d]\">Post a comment</a> :: <a

href=\"news.php?cmd=read&id=$myrow[news_i d]\">Read Comments</a> :: ($num_comments) Comments</td></tr></td></tr><tr><td></tr></td></td></tr></td></tr></table></table>";
}[/code:1:9f68712c98]

thats' a lil chunk of my news.php ... actualy not even close to little more like microscopic chunk lmao . but anways it works out fine...to see it in action www.wargamershq.com
Reply With Quote
  #6  
Old 01-05-2005, 09:29 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

You have to run a query first Xing, like $query=mysql_query("SELECT blahblahblah,blah FROM blah");
$rows=mysql_num_rows($query);


Echo($rows);
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #7  
Old 01-05-2005, 11:29 AM
XinG
Unregistered

Posts: n/a

alrighty.. i'll try that i tell u results in a min...
Reply With Quote
  #8  
Old 01-05-2005, 11:36 AM
XinG
Unregistered

Posts: n/a

i get this error :
[code:1:0b4a42764c]
Parse error: parse error, unexpected T_STRING in /home/feraira/public_html/Portfolio/XinG-Designs/news.php on line 16
[/code:1:0b4a42764c]
Reply With Quote
  #9  
Old 01-05-2005, 11:40 AM
XinG
Unregistered

Posts: n/a

ok, sorry for this.. (3rd post lol) BUT it still says 0... even if theres 2+ .. =/ this the code i got
[code:1:23a25c4ec1]$query=mysql_query("SELECT id FROM comments WHERE nid='$id'");
$totcomms=mysql_num_rows($query);[/code:1:23a25c4ec1]

nid = news id
id = comment id[/code]
Reply With Quote
  #10  
Old 01-05-2005, 01:12 PM
phplargo not loggged in:(
Unregistered

Posts: n/a

you need a while(){


like you have:
$query=mysql_query("SELECT id FROM comments WHERE nid='$id'");
$totcomms=mysql_num_rows($query);

do
$query=mysql_query("SELECT * FROM comments");
$totcomms=mysql_num_rows($query);

while($row=mysql_fetch_array($query)){
$query2=mysql_query("SELECT * FROM comments WHERE nid='$row[id]'");
$totcomms=mysql_num_rows($query2);
echo"$totcomms";


}
Reply With Quote
  #11  
Old 01-05-2005, 01:20 PM
XinG
Unregistered

Posts: n/a

owww... tried it, stil get same result
Reply With Quote
  #12  
Old 01-05-2005, 06:17 PM
PHP-Largo
Unregistered

Posts: n/a

are you error debugging...cuz when i ask for advice i do what they sya get a error, and then go error debugging of my script and find out that it was me :S just an idea
Reply With Quote
  #13  
Old 01-07-2005, 09:54 AM
XinG
Unregistered

Posts: n/a

lol, this may sound stupid.. but how?
Reply With Quote
  #14  
Old 01-10-2005, 07:16 PM
PHP-Largo
Unregistered

Posts: n/a

lol just read through the stuff look for errors, basically do stuff like that...and of course do what certain error messages tell u ... like if it says line whatever look there and see and then look around it .... it can be hard to catch the most basic stuff , including the ;
Reply With Quote
  #15  
Old 01-10-2005, 08:44 PM
BB/Mike
Unregistered

Posts: n/a

Xing, contact me, i got that file you wanted....
Reply With Quote
  #16  
Old 01-11-2005, 08:57 AM
Guest
Unregistered

Posts: n/a

WHOO thanks Mike! LOVE YOU! lol.. I'll be on at around 3:30 (GMT Time)
Reply With Quote
  #17  
Old 01-11-2005, 08:58 AM
XinG
Unregistered

Posts: n/a

that was by me ^_^ forgot to log in lol

Mike if u can get hold of me on msn forward it to xingtw@gmail.com / xingdesigns@gmail.com
(if u want)
Reply With Quote
  #18  
Old 01-11-2005, 12:27 PM
Guest
Unregistered

Posts: n/a

lol, thanks mike, just got it, testing it now..


it doesnt edit.. i just does nothing?
Reply With Quote
  #19  
Old 01-11-2005, 07:48 PM
BB/Mike
Unregistered

Posts: n/a

it works on my server on my local machine, check your email
Reply With Quote
  #20  
Old 01-12-2005, 02:57 PM
XinG
Unregistered

Posts: n/a

ARGGGH Mike! i lost that link u gave me on meh site? .. do u av it still? if u dnt, dnt worry lol
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"LIVE FREE or DIE HARD" coming soon 6/27/07 Hellfighter General Chat 3 06-13-2007 11:54 AM
history of the "F" word posted by Mstenger404 bigsmellyfart Humor & Jokes 10 01-24-2006 08:53 PM
NL & NW New rule not listed "Stat Padding" Hellfighter General Chat 0 09-02-2003 04:30 PM
"pogostick" "jump-gunning" GravyFace_BMF General Chat 11 11-16-2002 05:13 PM
New BHD Demo Map - "Night Time in Death City" DevilDog#1 Delta Force 0 10-13-2002 12:35 AM


All times are GMT -5. The time now is 12:41 PM.




Powered by vBulletin®