NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page would this...php/mysql question

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-14-2005, 05:00 PM THREAD STARTER               #1 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
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']."'")); 
????: NamePros.com http://www.namepros.com/programming/75336-would-this-php-mysql-question.html
would that set $find_replies to the amount of id's counted?
liam_d is offline  
Old 03-14-2005, 05:29 PM   #2 (permalink)
NamePros Regular
Join Date: Jun 2003
Location: Louisiana, USA
Posts: 658
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?
painperdu is offline  
Old 03-14-2005, 09:36 PM   #3 (permalink)
NamePros Member
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 127
eagle12 will become famous soon enougheagle12 will become famous soon enough
 



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']."'")); 
????: NamePros.com http://www.namepros.com/showthread.php?t=75336
$find_replies $row[0]; 
eagle12 is offline  
Old 03-14-2005, 10:58 PM   #4 (permalink)
NamePros Regular
Join Date: Oct 2003
Location: Sweden
Posts: 395
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); 
????: NamePros.com http://www.namepros.com/showthread.php?t=75336
should do the trick as well.
cerebus is offline  
Old 03-15-2005, 07:10 AM THREAD STARTER               #5 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
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']."'")); 
????: NamePros.com http://www.namepros.com/showthread.php?t=75336
liam_d is offline  
Closed Thread


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


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

Liquid Web Smart Servers  
All times are GMT -7. The time now is 04:36 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger