[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 03-14-2005, 04:00 PM   #1 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
 
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,648
0.00 NP$ (Donate)

liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all


would this...php/mysql question

PHP Code:
$find_replies = mysql_num_rows(mysql_query("SELECT COUNT(id) FROM `forum_replies` WHERE `topic_id` = '".$_GET['topic']."'"));
would that set $find_replies to the amount of id's counted?
liam_d is offline  
Old 03-14-2005, 04:29 PM   #2 (permalink)
NamePros Regular
 
Join Date: Jun 2003
Location: Louisiana, USA
Posts: 665
33.75 NP$ (Donate)

painperdu has a spectacular aura aboutpainperdu has a spectacular aura about


Yes, it looks like it should count all of the id replies to topic_id.

Is this what you want. Have you tried it?
__________________
******dotbob.com******
Cheap Domain Name Registrations
**** -Dotbob.com
painperdu is offline  
Old 03-14-2005, 08:36 PM   #3 (permalink)
NamePros Member
 
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 91
80.80 NP$ (Donate)

eagle12 is on a distinguished road


I don't think it does what you are looking for. That will always return a 1, because the SQL is going to return 1 row: "Count" that counts all the records where `topic_id` = '".$_GET['topic'].

You can do 1 of 2 things change the code to :

PHP Code:
 $find_replies = mysql_num_rows(mysql_query("SELECT * FROM `forum_replies` WHERE `topic_id` = '".$_GET['topic']."'"));
or

PHP Code:
$row = mysql_fetch_row(mysql_query("SELECT COUNT(id) FROM `forum_replies` WHERE `topic_id` = '".$_GET['topic']."'"));
$find_replies = $row[0];
eagle12 is offline  
Old 03-14-2005, 09:58 PM   #4 (permalink)
NamePros Regular
 
Join Date: Oct 2003
Location: Sweden
Posts: 395
655.10 NP$ (Donate)

cerebus has a spectacular aura aboutcerebus has a spectacular aura about

Animal Rescue Wildlife Animal Cruelty
PHP Code:
$find_replies=mysql_result(mysql_query("SELECT COUNT(id) FROM `forum_replies` WHERE `topic_id` = '".$_GET['topic']."'"),0);
should do the trick as well.
cerebus is offline  
Old 03-15-2005, 06:10 AM   #5 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
 
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,648
0.00 NP$ (Donate)

liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all


i have done this and it works fine now;

PHP Code:
$count_replies = mysql_fetch_array(mysql_query("SELECT COUNT(id) AS `count` FROM `forum_replies` WHERE `topic_id` = '".$_GET['topic']."'"));
liam_d is offline  
Closed Thread


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

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
little question.. khkhan Domain Appraisals 2 11-20-2004 04:28 AM
two-letter .com domain question questioning Domain Name Discussion 1 10-05-2004 04:08 PM
Simple PHP/MySQL question dcmginc Programming 8 10-02-2004 03:34 AM
PHP/MySQL question QBert Programming 1 10-01-2004 03:22 AM
OScommerce Loaded question geoffd3 Programming 1 03-01-2004 07:35 AM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 08:43 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85