arhg why wont my php script work??
Moderator: General Moderators
Code: Select all
if($num != FALSE)mysql_num_rows() only returns FALSE if it couldn't connect to the database, or similar such errors.
For that circumstance, the if challenge should read (in my opinion):
EDIT: You should also read up on security, in particular, SQL Injection prevention.
For that circumstance, the if challenge should read (in my opinion):
Code: Select all
if ($num < 1)Maybe his db connection string is flatlined.Jenk wrote:mysql_num_rows() only returns FALSE if it couldn't connect to the database, or similar such errors.
For that circumstance, the if challenge should read (in my opinion):EDIT: You should also read up on security, in particular, SQL Injection prevention.Code: Select all
if ($num < 1)
After your mysql_connect() and mysql_select_db() put this to see if the error is with your db connection:Ralle wrote:but $num ALWAYS output NOTHING.. I can't understand it.. $num is not less than 1, it's less than nothing at all.. know how to fix it???
Code: Select all
$link = mysql_connect("localhost", $username, $password) or die('Could not connect: ' . mysql_error());
mysql_select_db("yourDB") or die('Could not select database': . mysql_error());I found 2 bugs that made your telling work.
should be
and
should be
it works perfect now!
Code: Select all
=<Code: Select all
<=Code: Select all
$idCode: Select all
'$id'Sweet! Where were those "bugs" at?Ralle wrote:I found 2 bugs that made your telling work.
should beCode: Select all
=<andCode: Select all
<=should beCode: Select all
$idit works perfect now!Code: Select all
'$id'
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Just around the script. It's cool now..dallasx wrote:Sweet! Where were those "bugs" at?Ralle wrote:I found 2 bugs that made your telling work.
should beCode: Select all
=<andCode: Select all
<=should beCode: Select all
$idit works perfect now!Code: Select all
'$id'