Current location: Hot Scripts Forums » Programming Languages » PHP » help debug


help debug

Reply
  #1 (permalink)  
Old 08-05-05, 06:23 AM
aprogrammer aprogrammer is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
help debug

here's my code

PHP Code:

$sql="SELECT count(customerid) as countcustomer from customer";

echo 
$sql;
$result mysql_query($sql) or die(mysql_error()); 
echo 
"Total:";
echo 
$result[0]; 
The result prints out total: and blank -- no number ---
if i run the same query from php my admin I get the number of records.
Waht am I doing wrong?
Reply With Quote
  #2 (permalink)  
Old 08-05-05, 07:16 AM
darkfreak's Avatar
darkfreak darkfreak is offline
Newbie Coder
 
Join Date: Jun 2004
Location: Kuopio, Finland, Europe
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Variable $result is just a pointer to your query results. You must use that pointer to pick up your actual result row with - for example - mysql_fetch_row($result) -function.

PHP Code:

$sql="SELECT count(customerid) as countcustomer from customer";

echo 
$sql;
$result mysql_query($sql) or die(mysql_error()); 
$row mysql_fetch_row($result);
echo 
"Total:";
echo 
$row[0]; 
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
How do I debug my Java applets to see what's going wrong? laxy_m Everything Java 2 12-09-04 02:06 PM
I difficul to debug code ASP tola_ch2004 JavaScript 1 11-09-04 02:25 AM
debug mode vs run mode when passing variants nyquil Visual Basic 1 05-17-04 08:41 AM
.NET: Best practise to debug 2 web service that communicate together?!? gicio ASP.NET 0 03-19-04 06:31 AM
debug asp script sal21 ASP 1 09-07-03 08:10 AM


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