Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

This is a note on an error that I have gotten several times when writing php scripts with mySQL.

The error is:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

The offending code snippet essentially looks like this:

$result = mysql_query(“$query_STRING” );
if (mysql_num_rows($result) > 0)
{

which then continues on…

Note that $query_STRING is a string variable that contains the mySQL query.

The problem with this error message is that it is typically due to a problem in the query itself, and there can be many causes.  To catch the cause, change the line that performs the query to:

$result = mysql_query(“$query_STRING” ) or die(mysql_error());

The statement die(mysql_error()) will catch the true error and with luck give you a more meaningful error message.

Posted under Programming, Software

This post was written by drknuth on January 31, 2009

Tags: , , ,

Mad Science Blocks

Xylocopa sells some very cool Mad Science Blocks

Mad Scientist Blocks

Mad Scientist Blocks

These blocks sport mad science imagery ranging from caffeine to goggles, and are a MUST for your favorite Mad Scientist.

Posted under Gadgets, Product, Stuff

This post was written by drknuth on January 31, 2009

Tags: , , , , ,

Reassembling Robots

Mark Yim, associate professor member of the General Robotics, Automation, Sensing and Perception (GRASP) Lab at the University of Pennsylvania, introduces reassembling/reconfiguring robots.

The robot below called Ckbot is constructed of 15 modules grouped into 3 clusters of 5 modules each. Each cluster is equipped with a camera (24 frames per second video), a blinker LED, and an accelerometer. The other modules have proximity sensors, servo motors, and a computer. When the system is disassembled, each cluster rights itself and seeks out the other clusters so that they may dock and reconstruct the robot.

Posted under Research, Robotics

This post was written by drknuth on January 30, 2009

Tags:

Pharmaceutical Keywords to Catch Spammers

In the ongoing battle against spammers, one spammer recently made a mistake and spammed this site with over 250 pharamceutical (drug) keywords in a period of just a few days.  This allowed me to scrape the keywords and insert them into my WordPress Comment Blacklist under the Discussion Settings.

I list these pharmaceutical / drug names here so that other bloggers can use them as well.  Please note that there are two lists.  The first list contains the more common drugs.  You may wish to leave these out of your WordPress Comment Blacklist.   The second list contains less common drugs.  I will add to these lists as I obtain more.

Good Luck!

Common Drug Names (less likely to be spam)

alcohol
amoxycillin
cipro
claritin
marijuana
nicotine
opium
softtabs
steroids
tylenol

Drug Names

accolate
accutane
aciphex
acomplia
actos
adderall
adipex
advair
albina
albuterol
aldara
alendronate
alesse
allopurinol
alprazolam
amaryl
ambien
amitriptyline
antabuse
antihistamine
antivert
aphthasol
arava
atarax
atenolol
atorvastatin
augmentin
azithromycin
azmacort
bactroban
baycol
benicar
bupropion
buspar
buta
butorphanol
captopril
carisoprodol
cefixime
ceftin
celecoxib
celexa
cephalaxin
cetirizine
cialis
climara
clomid
clonazepam
clonidine
clopidogrel
colchicine
compazine
condylox
coumadin
cozaar
cyanocobalamin
cyclessa
cyclobenzaprine
denavir
depakote
desloratadine
detrol
diazepam
didrex
dilantin
diprolene
ditropan
dovonex
doxazosin
doxycycline
effexor
elavil
elidel
elocon
enalapril
esomeprazole
estradiol
evoxac
fabiola
famvir
finasteride
fioricet
flagyl
flexeril
flomax
flonase
flovent
fluconazole
flumadine
fluoxetine
folic
fosamax
furosemide
gemfibrozil
glipizide
glucophage
glyburide
hashish
hydrochlorothiazide
hydrocodone
hyzaar
imitrex
ionamin
keflex
kenalog
keppra
ketamine
klonopin
lamisil
lanoxin
lescol
levitra
lexapro
lipitor
lorcet
losartan
lotensin
lotrel
lsd
macrobid
meclizine
medrol
medroxyprogesterone
meridia
methamphetamine
methylprednisolone
miacalcin
microzide
miralax
mirapex
mircette
motrin
naproxen
nardil
nasacort
nasonex
neurontin
nicotrol
nifedipine
nortriptyline
norvasc
orlistat
ovral
oxycodone
oxycontin
paroxetine
patanol
paxil
pcp
pepcid
phencyclidine
phendimetrazine
phenergan
phentermine
pioglitazone
plavix
plendil
pravastatin
prevacid
prilosec
prinivil
propecia
protopic
provigil
prozac
psilocybin
psilocyn
rabeprazole
relafen
relenza
remeron
renova
restoril
retin
risedronate
risperdal
roxicet
sarafem
selsun
serevent
seroquel
sertraline
sibutramine
singulair
skelaxin
spironolactone
sumatriptan
sumycin
symmetrel
synalar
synthroid
tadalafil
tamiflu
tamoxifen
tamsulosin
temazepam
temovate
tenuate
terazosin
terbinafine
testosterone
tetracycline
tiazac
toprol
tramadol
transderm
tretinoin
triamterene
tricor
trimox
triphasil
tussionex
ultram
ultravate
valacyclovir
valtrex
vaniqa
vardenafil
vasotec
verapamil
viagra
vicodin
vicoprofen
vioxx
vytorin
wellbutrin
xalatan
xanax
xenical
yasmin
zanaflex
zestoretic
zestril
ziac
zithromax
zocor
zoloft
zyban
zyloprim
zyprexa
zyrtec

Posted under Internet