Current location: Hot Scripts Forums » Programming Languages » PHP » incorrect code, plz show me real code


incorrect code, plz show me real code

Reply
  #1 (permalink)  
Old 11-20-03, 03:43 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
incorrect code, plz show me real code

hi,

a different php forum gave mee a code to show a no item found error that gave me a parse error heres the line of code they gave me:

PHP Code:

if (mysql_numrows(mysql_query($results "without LIMIT"))>0) {} else {echo "Nothing found";} 

if this is right, then what am i doing wrong.thx
Reply With Quote
  #2 (permalink)  
Old 11-20-03, 04:41 PM
YourPHPPro's Avatar
YourPHPPro YourPHPPro is offline
Community VIP
 
Join Date: Aug 2003
Posts: 430
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by darkcarnival
PHP Code:

if (mysql_numrows(mysql_query($results "without LIMIT"))>0) {} else {echo "Nothing found";} 

What is $results ??
Reply With Quote
  #3 (permalink)  
Old 11-20-03, 05:34 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
$results is the results of $query
Reply With Quote
  #4 (permalink)  
Old 11-20-03, 05:41 PM
YourPHPPro's Avatar
YourPHPPro YourPHPPro is offline
Community VIP
 
Join Date: Aug 2003
Posts: 430
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

mysql_query($results "without LIMIT"
That wont work unless there is a typo as mysql_query needs a comma between its query and resource link.

Quote:
resource mysql_query ( string query [, resource link_identifier])
The better way to find out how many results there are is by using a query like:

Code:
Select count(*) as Count from table where .....
Reply With Quote
  #5 (permalink)  
Old 11-21-03, 02:40 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
ok i got told to try that as well but what do i add to WHERE? if you could tel me how to do where i could do this.thx.
Reply With Quote
Reply

Bookmarks


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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
please show me the code....... fui_koh Script Requests 1 07-07-03 01:04 PM
show me the code please......... fui_koh PHP 2 07-07-03 11:56 AM


All times are GMT -5. The time now is 05:56 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.