Jump to content

So what's wrong here?


Moron

Recommended Posts

[quote]
$RESULTDS=mssql_query("SELECT DISTINCT LH.[Employee Number], LH.[Lmo], LH.[Lda], LH.[LYR], LH.[Hours], LH.[Leave Code], M2.[HRYRAT], M2.[EMPNO], M2.[MANLAP], M2.[MANLAC], M2.[MANLTC], M2.[MSKLAB], M2.[MSKLTC], M2.[MSKLAB], M2.[MSKLTC], M2.[NAMEMI], M2.[NAMEL], M2.[NAMEF] FROM LEAVHST LH INNER JOIN MASTERL2 M2 ON LH.[Employee Number]=M2.EMPNO WHERE M2.[EMPNO] = '".$_POST['employeenumber']."'  and LH.[LYR] >= '$last'  and LH.[Lda] >= '01' and LH.[Lmo] >= '07' ORDER BY LH.[LYR] desc, LH.[Lmo] desc, LH.[Lda] desc");
$RESULT=mssql_fetch_assoc($RESULTDS);


[b]$num_rows = mssql_num_rows($result['EMPNO']);
echo "$num_rows Rows\n";[/b]
[/quote]

The query works fine. The part I put in [b]bold[/b] gives this error:

[quote]
[b]Warning:[/b] mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in [b]E:\User\Inetpub\wwwroot\PHPLeaveTime\leaveprocess.php[/b] on line [b]221[/b]
Rows[/quote]
Link to comment
Share on other sites

It doesn't work like that, you feed a query to mysql_num_rows not an array value or key like tihs

$select = "SELECT QUERY GOES HERE;";
$query = mysql_query($select);
$num = mysql_num_rows($query);
That would record the number of rows that were selected, it'll also work for update, and delete I believe to return the number that it acted upon.

Edit:

I replied at the same time you replied, that was cool.
Link to comment
Share on other sites

[quote author=HeyRay2 link=topic=105615.msg422006#msg422006 date=1156526391]
Changing this line...

[code]
$num_rows = mssql_num_rows($result['EMPNO']);
[/code]

...to this...

[code]
$num_rows = mssql_num_rows($RESULTDS);
[/code]

...should get you on the right track... ;)
[/quote]

Yep. It works.

Thanks!

:)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.