Moron Posted August 25, 2006 Share Posted August 25, 2006 [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] Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/ Share on other sites More sharing options...
wildteen88 Posted August 25, 2006 Share Posted August 25, 2006 I guess $result['EMPNO'] holds an array. If it holds an array and you want to know how many items are in that array use count().mssql_num_rows returns the number of rows returned from the SQL query. Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80378 Share on other sites More sharing options...
Ninjakreborn Posted August 25, 2006 Share Posted August 25, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80379 Share on other sites More sharing options...
wildteen88 Posted August 25, 2006 Share Posted August 25, 2006 Dont double post! Use the modify button! I keep telling you that but you never listen. Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80381 Share on other sites More sharing options...
Ninjakreborn Posted August 25, 2006 Share Posted August 25, 2006 Sorry about that, I didn't see what you mean until now, THe only thing is when I am bumping If I modify it doesn't bump, but back to the problem, did you figure out what you needed, did it work this time? Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80382 Share on other sites More sharing options...
HuggieBear Posted August 25, 2006 Share Posted August 25, 2006 What's 'bumping' guys?Rich Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80383 Share on other sites More sharing options...
Ninjakreborn Posted August 25, 2006 Share Posted August 25, 2006 When something goes to the bottom, if you put the word, bump or anything it pops it back up to the first post. Also we can't keep hijacking this post it has to get back on track. Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80388 Share on other sites More sharing options...
HeyRay2 Posted August 25, 2006 Share Posted August 25, 2006 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 Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80403 Share on other sites More sharing options...
Moron Posted August 25, 2006 Author Share Posted August 25, 2006 [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! :) Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80452 Share on other sites More sharing options...
HeyRay2 Posted August 25, 2006 Share Posted August 25, 2006 Glad to help! ;) Quote Link to comment https://forums.phpfreaks.com/topic/18650-so-whats-wrong-here/#findComment-80465 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.