TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Programing Languages > PHP

Notices

problem with mysql_num_rows()

PHP


Reply
 
Thread Tools Display Modes
Old 04-12-2007, 10:13 AM   #11
AnrDaemon
Guest
 
Posts: n/a
Re: problem with mysql_num_rows()

Greetings, mantrid.
In reply to Your message dated Saturday, December 1, 2007, 04:06:08,

> Im an idiot. It was the sql, but not because the syntax was wrong. It was
> just that the sql was using variables taken from rows of a text file.


Why it is always true to have valid SQL resultset before coding something in
other languages.
If You getting an error around mysql_query, first make sure You have expected
result in it. Then check something other.


--
Sincerely Yours, AnrDaemon <>

  Reply With Quote
Old 04-12-2007, 10:13 AM   #12
AnrDaemon
Guest
 
Posts: n/a
Re: problem with mysql_num_rows()

Greetings, Jerry Stuckle.
In reply to Your message dated Sunday, December 2, 2007, 05:03:10,

> But what I was referring to was not so much $sqlsomething or $rsomething
> (although I do like $result, $queryNameResult or similar. I meant the
> use of $k, $_k especially. You shouldn't start a variable name with an
> underscore (it's generally reserved for system stuff), and it's very
> difficult to see what you're doing in your loops with such similar names.


While You partially true, I'd point to the fact that __names reserved for
system use.

Im using $_name variables to identify read-only temporary storages such as
query strings ($_q typically) and resultsets ($_r, $_rc or something), which
is used almost immediately and assigned only once. Larger code part where I
use such names was completely fit to screen and easy to observe.

While I know that such short names are not allowed due to lack of meaning, I
have this behaviour properly documented in project description.

And it is really easy to code short names while You have mass of dealing with
external I/O (either database, files or remote websites).

Another use of _names is an internal object properties and methods, where it
is easier to determine if that property/method is public or private/protected.


--
Sincerely Yours, AnrDaemon <>

  Reply With Quote
Old 04-12-2007, 10:14 AM   #13
Jerry Stuckle
Guest
 
Posts: n/a
Re: problem with mysql_num_rows()

AnrDaemon wrote:
> Greetings, Jerry Stuckle.
> In reply to Your message dated Sunday, December 2, 2007, 05:03:10,
>
>> But what I was referring to was not so much $sqlsomething or $rsomething
>> (although I do like $result, $queryNameResult or similar. I meant the
>> use of $k, $_k especially. You shouldn't start a variable name with an
>> underscore (it's generally reserved for system stuff), and it's very
>> difficult to see what you're doing in your loops with such similar names.

>
> While You partially true, I'd point to the fact that __names reserved for
> system use.
>


Right now I don't see where either one is not recommended, but I know
I've seen it someplace. Just have to find out where.

> Im using $_name variables to identify read-only temporary storages such as
> query strings ($_q typically) and resultsets ($_r, $_rc or something), which
> is used almost immediately and assigned only once. Larger code part where I
> use such names was completely fit to screen and easy to observe.
>


If it's a constant, then it should be defined as a constant. Such
naming conventions make your code much harder for anyone else to
understand.

> While I know that such short names are not allowed due to lack of meaning, I
> have this behaviour properly documented in project description.
>


It still doesn't mean the names aren't confusing. It's much better to
use meaningful names. And if something is a constant, it should be
defined as a constant.

> And it is really easy to code short names while You have mass of dealing with
> external I/O (either database, files or remote websites).
>


And it's really easy to make your code virtually unreadable by someone
else when using short names.

> Another use of _names is an internal object properties and methods, where it
> is easier to determine if that property/method is public or private/protected.
>
>


Keep all your properties private, as they should be, and you don't have
the problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

==================

  Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 05:11 AM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional