Page 2 of 2

Posted: Sat Oct 22, 2005 1:32 pm
by Ralle
can you write it?? I am not very good at messing with actions in IF-stuff

Posted: Sat Oct 22, 2005 1:50 pm
by dallasx

Code: Select all

if($num != FALSE)

Posted: Sat Oct 22, 2005 2:09 pm
by Jenk
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):

Code: Select all

if ($num < 1)
EDIT: You should also read up on security, in particular, SQL Injection prevention.

Posted: Sat Oct 22, 2005 2:16 pm
by Ralle
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???

Posted: Sat Oct 22, 2005 2:23 pm
by dallasx
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):

Code: Select all

if ($num < 1)
EDIT: You should also read up on security, in particular, SQL Injection prevention.
Maybe his db connection string is flatlined.

Posted: Sat Oct 22, 2005 2:27 pm
by dallasx
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???
After your mysql_connect() and mysql_select_db() put this to see if the error is with your db connection:

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());

Posted: Sat Oct 22, 2005 2:31 pm
by Ralle
I found 2 bugs that made your telling work.

Code: Select all

=<
should be

Code: Select all

<=
and

Code: Select all

$id
should be

Code: Select all

'$id'
it works perfect now!

Posted: Sun Oct 23, 2005 12:43 pm
by dallasx
Ralle wrote:I found 2 bugs that made your telling work.

Code: Select all

=<
should be

Code: Select all

<=
and

Code: Select all

$id
should be

Code: Select all

'$id'
it works perfect now!
Sweet! Where were those "bugs" at?

Posted: Sun Oct 23, 2005 1:04 pm
by John Cartwright
Theres only 1 instance of the above mentioned "bugs" in your code..
I don't see why you can't do it yourself :evil:

Posted: Sun Oct 23, 2005 2:19 pm
by Ralle
dallasx wrote:
Ralle wrote:I found 2 bugs that made your telling work.

Code: Select all

=<
should be

Code: Select all

<=
and

Code: Select all

$id
should be

Code: Select all

'$id'
it works perfect now!
Sweet! Where were those "bugs" at?
Just around the script. It's cool now..