problem with mysql_num_rows()

This is a discussion on problem with mysql_num_rows() within the PHP Language forums, part of the PHP Programming Forums category; I am getting the following error. I cant see what is wrong. I am probably overlooking something obvious, can anyone ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-30-2007
mantrid
 
Posts: n/a
Default problem with mysql_num_rows()

I am getting the following error. I cant see what is wrong. I am probably
overlooking something obvious, can anyone see what is wrong ? The sql is ok
as used elsewhere. Problem only occurs when i include the mysql_num_rows()
function


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /home/iddsoftw/public_html/cgtcalc/addcomp.php on line 76


$sql30daycheck = "SELECT * FROM cgttransactions WHERE
companyid=$impcompanyid AND selldatetime IS NOT NULL AND bbprice IS NULL AND
selldatetime >=DATE_SUB('".$impdatetime."', INTERVAL 30 DAY) ORDER BY
selldatetime DESC "; //LIMIT 1 DATE(NOW()) > finstart AND DATE(NOW()) <
DATE_ADD(finstart, INTERVAL 1 YEAR)"

**************************
if(mysql_num_rows(mysql_query($sql30daycheck))){ <<<<<<<<
line 76
$q30daycheck = mysql_query($sql30daycheck);
while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
extract($r30daycheck);

******* some code here using $r30daycheck ******
}
}

******************







Reply With Quote
  #2 (permalink)  
Old 11-30-2007
lamib
 
Posts: n/a
Default Re: problem with mysql_num_rows()

mantrid wrote:
> I am getting the following error. I cant see what is wrong. I am probably
> overlooking something obvious, can anyone see what is wrong ? The sql is ok
> as used elsewhere. Problem only occurs when i include the mysql_num_rows()
> function
>
>
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
> resource in /home/iddsoftw/public_html/cgtcalc/addcomp.php on line 76
>
>
> $sql30daycheck = "SELECT * FROM cgttransactions WHERE
> companyid=$impcompanyid AND selldatetime IS NOT NULL AND bbprice IS NULL AND
> selldatetime >=DATE_SUB('".$impdatetime."', INTERVAL 30 DAY) ORDER BY
> selldatetime DESC "; //LIMIT 1 DATE(NOW()) > finstart AND DATE(NOW()) <
> DATE_ADD(finstart, INTERVAL 1 YEAR)"
>
> **************************
> if(mysql_num_rows(mysql_query($sql30daycheck))){ <<<<<<<<
> line 76
> $q30daycheck = mysql_query($sql30daycheck);
> while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
> extract($r30daycheck);
>
> ******* some code here using $r30daycheck ******
> }
> }
>
> ******************
>
>
>
>
>
>
>


I'm not entirely sure (as I use a MySQL library to ease the task), but
try doing something like "$queryresult = mysql_query($sql30daycheck)"
first and doing mysql_num_rows($queryresult).

--
www.lamib.info
Reply With Quote
  #3 (permalink)  
Old 12-01-2007
Shelly
 
Posts: n/a
Default Re: problem with mysql_num_rows()

lamib wrote:
> mantrid wrote:
>> I am getting the following error. I cant see what is wrong. I am
>> probably overlooking something obvious, can anyone see what is wrong
>> ? The sql is ok as used elsewhere. Problem only occurs when i
>> include the mysql_num_rows() function
>>
>>
>> Warning: mysql_num_rows(): supplied argument is not a valid MySQL
>> result resource in /home/iddsoftw/public_html/cgtcalc/addcomp.php on
>> line 76 $sql30daycheck = "SELECT * FROM cgttransactions WHERE
>> companyid=$impcompanyid AND selldatetime IS NOT NULL AND bbprice IS
>> NULL AND selldatetime >=DATE_SUB('".$impdatetime."', INTERVAL 30
>> DAY) ORDER BY selldatetime DESC "; //LIMIT 1 DATE(NOW()) > finstart
>> AND DATE(NOW()) < DATE_ADD(finstart, INTERVAL 1 YEAR)"
>>
>> **************************
>> if(mysql_num_rows(mysql_query($sql30daycheck))){ <<<<<<<<
>> line 76
>> $q30daycheck = mysql_query($sql30daycheck);
>> while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
>> extract($r30daycheck);
>>
>> ******* some code here using $r30daycheck ******
>> }
>> }
>>
>> ******************
>>
>>
>>
>>
>>
>>
>>

>
> I'm not entirely sure (as I use a MySQL library to ease the task), but
> try doing something like "$queryresult = mysql_query($sql30daycheck)"
> first and doing mysql_num_rows($queryresult).


I was going to make the same suggestion.

This reminded me of what I call the C programmer's "Name That Tune" complex.

I can code that in 5 lines.
I can do it in 4 lines.
It would only take me 3 lines .
-- Write that code!

(For those not old enough, there was a show called Name That Tune and
contestents bid on how few notes they would need to name the tune). That
kind of C programmer would put everything into the for loop so that
everything was on one line. It was a debugging -- and code reading --
nightmare. I always found it better to use 2,3,4 or 5 lines or whatever it
took so that I could put breakpoints in and readily trace what was going on
to debug a problem.

I would also have written his query as:

$sql30daycheck = "SELECT * FROM cgttransactions WHERE ".
"companyid=" . $impcompanyid . " AND ".
"selldatetime IS NOT NULL AND " . "
"bbprice IS NULL AND " .
"selldatetime >=DATE_SUB('" . $impdatetime.
"', INTERVAL 30 DAY) " .
"ORDER BY selldatetime DESC ";
` //LIMIT 1 DATE(NOW()) > finstart
//AND DATE(NOW()) <
DATE_ADD(finstart, INTERVAL 1 YEAR)

.....at least that is how the query SEEMS to be,

--
Shelly




Reply With Quote
  #4 (permalink)  
Old 12-01-2007
mantrid
 
Posts: n/a
Default Re: problem with mysql_num_rows()

Ok
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.

while (($data = fgetcsv($handle, 1500)) !== FALSE) {
list($imptype,$impuserid, $impmyvarid,$impcompanyid, $impaimlisted,
$impamount, $impprice, $impstamp, $impcomm, $impdate,$imptime) = $data; //
explode(",", $data)
......
......
..etc
}

and i recently modified the structure of the text file without making
appropriate changes in the php. tut tut

Thank for your interest
Ian



"mantrid" <ian.dandav@virgin.net> wrote in message
news:Wj04j.74$1j1.72@newsfe7-gui.ntli.net...
> I am getting the following error. I cant see what is wrong. I am probably
> overlooking something obvious, can anyone see what is wrong ? The sql is

ok
> as used elsewhere. Problem only occurs when i include the mysql_num_rows()
> function
>
>
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
> resource in /home/iddsoftw/public_html/cgtcalc/addcomp.php on line 76
>
>
> $sql30daycheck = "SELECT * FROM cgttransactions WHERE
> companyid=$impcompanyid AND selldatetime IS NOT NULL AND bbprice IS NULL

AND
> selldatetime >=DATE_SUB('".$impdatetime."', INTERVAL 30 DAY) ORDER BY
> selldatetime DESC "; //LIMIT 1 DATE(NOW()) > finstart AND DATE(NOW()) <
> DATE_ADD(finstart, INTERVAL 1 YEAR)"
>
> **************************
> if(mysql_num_rows(mysql_query($sql30daycheck))){ <<<<<<<<
> line 76
> $q30daycheck = mysql_query($sql30daycheck);
> while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
> extract($r30daycheck);
>
> ******* some code here using $r30daycheck ******
> }
> }
>
> ******************
>
>
>
>
>
>
>



Reply With Quote
  #5 (permalink)  
Old 12-01-2007
Rik Wasmus
 
Posts: n/a
Default Re: problem with mysql_num_rows()

On Sat, 01 Dec 2007 00:09:36 +0100, Shelly
<sheldonlg.news@asap-consult.com> wrote:
>> I'm not entirely sure (as I use a MySQL library to ease the task), but
>> try doing something like "$queryresult = mysql_query($sql30daycheck)"
>> first and doing mysql_num_rows($queryresult).

>
> I was going to make the same suggestion.
>
> This reminded me of what I call the C programmer's "Name That Tune"
> complex.
>
> I can code that in 5 lines.
> I can do it in 4 lines.
> It would only take me 3 lines .
> -- Write that code!
>
> (For those not old enough, there was a show called Name That Tune and
> contestents bid on how few notes they would need to name the tune). That
> kind of C programmer would put everything into the for loop so that
> everything was on one line. It was a debugging -- and code reading --
> nightmare. I always found it better to use 2,3,4 or 5 lines or whatever
> it
> took so that I could put breakpoints in and readily trace what was going
> on
> to debug a problem.


Indeed, when efficiency of several possible solutions to a problem are
close, please, pleasego for the most legible one. Number of lines are not
a way to determine efficiency.

> I would also have written his query as:
>
> $sql30daycheck = "SELECT * FROM cgttransactions WHERE ".
> "companyid=" . $impcompanyid . " AND ".
> "selldatetime IS NOT NULL AND " . "
> "bbprice IS NULL AND " .
> "selldatetime >=DATE_SUB('" .
> $impdatetime.
> "', INTERVAL 30 DAY) " .


I would never do that. A query is one string, _with_ possible linebreaks,
and MySQL (if thats the flavour of your choice, which it usually is) will
tell you on which line the error was if there was any. Quite a handy
feature I'd say.

Can someone please explain this nonsense about not wanting linebreaks in
strings when they're perfectly legal (and in this case quite handy), and
concatinating further on other lines? HTML disregards whitespace like that
(save a few issues with UA's, in which case you just open/close the tags
on another line). I know it's the default of the IMHO unsuited for PHP use
Eclipse, which is one editor which has so many problems with my deault
coding style (and is quite bloated Java). It really was the final turn-off
for me (there are many, many other reasons) not to use that one. Yes, I
know I can change it in the settings.

Then again, I'm posting this 'cooling down' after a night out, so please
disregard any spelling errors and wrong assumptions.
--
Rik Wasmus
Reply With Quote
  #6 (permalink)  
Old 12-01-2007
Jerry Stuckle
 
Posts: n/a
Default Re: problem with mysql_num_rows()

mantrid wrote:
> Ok
> 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.
>
> while (($data = fgetcsv($handle, 1500)) !== FALSE) {
> list($imptype,$impuserid, $impmyvarid,$impcompanyid, $impaimlisted,
> $impamount, $impprice, $impstamp, $impcomm, $impdate,$imptime) = $data; //
> explode(",", $data)
> .....
> .....
> .etc
> }
>
> and i recently modified the structure of the text file without making
> appropriate changes in the php. tut tut
>
> Thank for your interest
> Ian
>
>
>
> "mantrid" <ian.dandav@virgin.net> wrote in message
> news:Wj04j.74$1j1.72@newsfe7-gui.ntli.net...
>> I am getting the following error. I cant see what is wrong. I am probably
>> overlooking something obvious, can anyone see what is wrong ? The sql is

> ok
>> as used elsewhere. Problem only occurs when i include the mysql_num_rows()
>> function
>>
>>
>> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
>> resource in /home/iddsoftw/public_html/cgtcalc/addcomp.php on line 76
>>
>>
>> $sql30daycheck = "SELECT * FROM cgttransactions WHERE
>> companyid=$impcompanyid AND selldatetime IS NOT NULL AND bbprice IS NULL

> AND
>> selldatetime >=DATE_SUB('".$impdatetime."', INTERVAL 30 DAY) ORDER BY
>> selldatetime DESC "; //LIMIT 1 DATE(NOW()) > finstart AND DATE(NOW()) <
>> DATE_ADD(finstart, INTERVAL 1 YEAR)"
>>
>> **************************
>> if(mysql_num_rows(mysql_query($sql30daycheck))){ <<<<<<<<
>> line 76
>> $q30daycheck = mysql_query($sql30daycheck);
>> while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
>> extract($r30daycheck);
>>
>> ******* some code here using $r30daycheck ******
>> }
>> }
>>
>> ******************
>>
>>
>>
>>
>>
>>
>>

>
>
>


But the other comments are still valid.

Right now you're calling mysql_query() twice; the second call is
completely unnecessary and causes additional overhead on MySQL and your
script.

Rather, do this:

$q30daycheck = mysql_query($sql30daycheck);
if (mysql_num_rows($q309daycheck)) {
while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
extract($r30daycheck);
....

And please - RENAME YOUR VARIABLES. Having two 12 character variables
which differ only by the first character is confusing and encourages
errors in your code.

For instance - use $result for the request from the query. Much easier
to understand.

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

Reply With Quote
  #7 (permalink)  
Old 12-01-2007
mantrid
 
Posts: n/a
Default Re: problem with mysql_num_rows()



"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:i8WdnTCdEvI2Wc3anZ2dnUVZ_ommnZ2d@comcast.com. ..
> mantrid wrote:
> > Ok
> > 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.
> >
> > while (($data = fgetcsv($handle, 1500)) !== FALSE) {
> > list($imptype,$impuserid, $impmyvarid,$impcompanyid, $impaimlisted,
> > $impamount, $impprice, $impstamp, $impcomm, $impdate,$imptime) = $data;

//
> > explode(",", $data)
> > .....
> > .....
> > .etc
> > }
> >
> > and i recently modified the structure of the text file without making
> > appropriate changes in the php. tut tut
> >
> > Thank for your interest
> > Ian
> >
> >
> >
> > "mantrid" <ian.dandav@virgin.net> wrote in message
> > news:Wj04j.74$1j1.72@newsfe7-gui.ntli.net...
> >> I am getting the following error. I cant see what is wrong. I am

probably
> >> overlooking something obvious, can anyone see what is wrong ? The sql

is
> > ok
> >> as used elsewhere. Problem only occurs when i include the

mysql_num_rows()
> >> function
> >>
> >>
> >> Warning: mysql_num_rows(): supplied argument is not a valid MySQL

result
> >> resource in /home/iddsoftw/public_html/cgtcalc/addcomp.php on line 76
> >>
> >>
> >> $sql30daycheck = "SELECT * FROM cgttransactions WHERE
> >> companyid=$impcompanyid AND selldatetime IS NOT NULL AND bbprice IS

NULL
> > AND
> >> selldatetime >=DATE_SUB('".$impdatetime."', INTERVAL 30 DAY) ORDER BY
> >> selldatetime DESC "; //LIMIT 1 DATE(NOW()) > finstart AND DATE(NOW()) <
> >> DATE_ADD(finstart, INTERVAL 1 YEAR)"
> >>
> >> **************************
> >> if(mysql_num_rows(mysql_query($sql30daycheck))){

<<<<<<<<
> >> line 76
> >> $q30daycheck = mysql_query($sql30daycheck);
> >> while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
> >> extract($r30daycheck);
> >>
> >> ******* some code here using $r30daycheck ******
> >> }
> >> }
> >>
> >> ******************
> >>
> >>
> >>
> >>
> >>
> >>
> >>

> >
> >
> >

>
> But the other comments are still valid.
>
> Right now you're calling mysql_query() twice; the second call is
> completely unnecessary and causes additional overhead on MySQL and your
> script.
>
> Rather, do this:
>
> $q30daycheck = mysql_query($sql30daycheck);
> if (mysql_num_rows($q309daycheck)) {
> while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
> extract($r30daycheck);
> ...
>
> And please - RENAME YOUR VARIABLES. Having two 12 character variables
> which differ only by the first character is confusing and encourages
> errors in your code.
>
> For instance - use $result for the request from the query. Much easier
> to understand.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================
>



"Right now you're calling mysql_query() twice; the second call is
completely unnecessary and causes additional overhead on MySQL and your
script."

Your are correct. I always do it your way, honestly. I posted the code I had
just been playing around with trying different things to see if I could get
it working. Hence the messiness of it with all the commented out code etc.

> And please - RENAME YOUR VARIABLES. Having two 12 character variables
> which differ only by the first character is confusing and encourages
> errors in your code.


You are right again. This is a habit of mine. I do it so i can identify
different calls to the database on the same page. I could use $result1,
$result2 etc. but this makes it easier for me. Also the small difference is
always at the front and follows the same pattern
$sqlsomething for the sql statement, $qsomething for the mysql_query,
$rsomething for the mysql_fetch etc. It makes sense for me and im not in a
team so dont have the problem of others needing to read my code


Reply With Quote
  #8 (permalink)  
Old 12-01-2007
mantrid
 
Posts: n/a
Default Re: problem with mysql_num_rows()

On the subject of variable length. Does a variable with a long name effect
performance?



"mantrid" <ian.dandav@virgin.net> wrote in message
news:Q5j4j.1674$jy3.1207@newsfe7-win.ntli.net...
>
>
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:i8WdnTCdEvI2Wc3anZ2dnUVZ_ommnZ2d@comcast.com. ..
> > mantrid wrote:
> > > Ok
> > > 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.
> > >
> > > while (($data = fgetcsv($handle, 1500)) !== FALSE) {
> > > list($imptype,$impuserid, $impmyvarid,$impcompanyid,

$impaimlisted,
> > > $impamount, $impprice, $impstamp, $impcomm, $impdate,$imptime) =

$data;
> //
> > > explode(",", $data)
> > > .....
> > > .....
> > > .etc
> > > }
> > >
> > > and i recently modified the structure of the text file without making
> > > appropriate changes in the php. tut tut
> > >
> > > Thank for your interest
> > > Ian
> > >
> > >
> > >
> > > "mantrid" <ian.dandav@virgin.net> wrote in message
> > > news:Wj04j.74$1j1.72@newsfe7-gui.ntli.net...
> > >> I am getting the following error. I cant see what is wrong. I am

> probably
> > >> overlooking something obvious, can anyone see what is wrong ? The sql

> is
> > > ok
> > >> as used elsewhere. Problem only occurs when i include the

> mysql_num_rows()
> > >> function
> > >>
> > >>
> > >> Warning: mysql_num_rows(): supplied argument is not a valid MySQL

> result
> > >> resource in /home/iddsoftw/public_html/cgtcalc/addcomp.php on line 76
> > >>
> > >>
> > >> $sql30daycheck = "SELECT * FROM cgttransactions WHERE
> > >> companyid=$impcompanyid AND selldatetime IS NOT NULL AND bbprice IS

> NULL
> > > AND
> > >> selldatetime >=DATE_SUB('".$impdatetime."', INTERVAL 30 DAY) ORDER BY
> > >> selldatetime DESC "; //LIMIT 1 DATE(NOW()) > finstart AND DATE(NOW())

<
> > >> DATE_ADD(finstart, INTERVAL 1 YEAR)"
> > >>
> > >> **************************
> > >> if(mysql_num_rows(mysql_query($sql30daycheck))){

> <<<<<<<<
> > >> line 76
> > >> $q30daycheck = mysql_query($sql30daycheck);
> > >> while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
> > >> extract($r30daycheck);
> > >>
> > >> ******* some code here using $r30daycheck ******
> > >> }
> > >> }
> > >>
> > >> ******************
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >

> >
> > But the other comments are still valid.
> >
> > Right now you're calling mysql_query() twice; the second call is
> > completely unnecessary and causes additional overhead on MySQL and your
> > script.
> >
> > Rather, do this:
> >
> > $q30daycheck = mysql_query($sql30daycheck);
> > if (mysql_num_rows($q309daycheck)) {
> > while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
> > extract($r30daycheck);
> > ...
> >
> > And please - RENAME YOUR VARIABLES. Having two 12 character variables
> > which differ only by the first character is confusing and encourages
> > errors in your code.
> >
> > For instance - use $result for the request from the query. Much easier
> > to understand.
> >
> > --
> > ==================
> > Remove the "x" from my email address
> > Jerry Stuckle
> > JDS Computer Training Corp.
> > jstucklex@attglobal.net
> > ==================
> >

>
>
> "Right now you're calling mysql_query() twice; the second call is
> completely unnecessary and causes additional overhead on MySQL and your
> script."
>
> Your are correct. I always do it your way, honestly. I posted the code I

had
> just been playing around with trying different things to see if I could

get
> it working. Hence the messiness of it with all the commented out code etc.
>
> > And please - RENAME YOUR VARIABLES. Having two 12 character variables
> > which differ only by the first character is confusing and encourages
> > errors in your code.

>
> You are right again. This is a habit of mine. I do it so i can identify
> different calls to the database on the same page. I could use $result1,
> $result2 etc. but this makes it easier for me. Also the small difference

is
> always at the front and follows the same pattern
> $sqlsomething for the sql statement, $qsomething for the mysql_query,
> $rsomething for the mysql_fetch etc. It makes sense for me and im not in a
> team so dont have the problem of others needing to read my code
>
>



Reply With Quote
  #9 (permalink)  
Old 12-02-2007
Ian Hobson
 
Posts: n/a
Default Re: problem with mysql_num_rows()

mantrid wrote:
> On the subject of variable length. Does a variable with a long name effect
> performance?
>

Not so as you would notice. (and nowhere near as much as two calls to
mysql-num-rows).

BTW. Not trimming properly when you reply to posts will upset a lot of
people.

Regards

(another) Ian
Reply With Quote
  #10 (permalink)  
Old 12-02-2007
Jerry Stuckle
 
Posts: n/a
Default Re: problem with mysql_num_rows()

mantrid wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>> But the other comments are still valid.
>>
>> Right now you're calling mysql_query() twice; the second call is
>> completely unnecessary and causes additional overhead on MySQL and your
>> script.
>>
>> Rather, do this:
>>
>> $q30daycheck = mysql_query($sql30daycheck);
>> if (mysql_num_rows($q309daycheck)) {
>> while($r30daycheck =& mysql_fetch_array($q30daycheck)) {
>> extract($r30daycheck);
>> ...
>>
>> And please - RENAME YOUR VARIABLES. Having two 12 character variables
>> which differ only by the first character is confusing and encourages
>> errors in your code.
>>
>> For instance - use $result for the request from the query. Much easier
>> to understand.
>>

>
>
> "Right now you're calling mysql_query() twice; the second call is
> completely unnecessary and causes additional overhead on MySQL and your
> script."
>
> Your are correct. I always do it your way, honestly. I posted the code I had
> just been playing around with trying different things to see if I could get
> it working. Hence the messiness of it with all the commented out code etc.
>


OK, no problem. I just mentioned it because I wasn't sure if you were
aware of it or not. Not knowing how much PHP experience you have, this
type of error is common amongst beginners.

>> And please - RENAME YOUR VARIABLES. Having two 12 character variables
>> which differ only by the first character is confusing and encourages
>> errors in your code.

>
> You are right again. This is a habit of mine. I do it so i can identify
> different calls to the database on the same page. I could use $result1,
> $result2 etc. but this makes it easier for me. Also the small difference is
> always at the front and follows the same pattern
> $sqlsomething for the sql statement, $qsomething for the mysql_query,
> $rsomething for the mysql_fetch etc. It makes sense for me and im not in a
> team so dont have the problem of others needing to read my code
>
>


I know, I started out in Fortran II about 40 years ago when variables
were limited to 6 (I think) characters. And even after learning other
languages I kept that idea for a long time.

But Hungarian Notation (which is what you're using) has fallen out of
favor in the past few years, especially with untyped languages such as PHP.

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.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:53 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0