Jump to content


Photo

I try to count and PHP pukes


  • Please log in to reply
3 replies to this topic

#1 rahenkamp

rahenkamp
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 18 June 2006 - 02:34 AM

I am trying to count the number of records in a MySQL DB with:

$sql = sprintf("SELECT COUNT(*) AS test FROM %s WHERE login = '%s' AND cc = '%s' AND schoolid= '%s'", 'classnotes', 'teacher', '0155', '0631');

$result = mysql_query($sql) or die(mysql_error());

but this is thowing an error "No Database Selected"

The same SQL statement works fine in PHPmyAdmin.

What don't I see?

Thanks in advance.

d





#2 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 18 June 2006 - 02:52 AM

Everyone, these are the Rules Of Engagement: Read the FAQs. Read the stickies. Read the manuals. And use Google. If those four fail, then make a post. Thanks.

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95432\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=95432[/a]
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#3 Fyorl

Fyorl
  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 18 June 2006 - 02:59 AM

In short, STFW
[table]



Don't worry, the printer fairies will sort it out.

#4 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 18 June 2006 - 03:47 AM

hm... I must say, I've never heard of that particular acronym :D
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users