Retrieving the row number of a specific record from the results of a MySQL query
I want to create a MySQL query that will return a list of
records, and then retrieve the row number of a record with a
specific ID. How can I do this?
*server-side script: PHP
<?php
$i = 0;
do {
$i++;
} while (mysql_fetch_assoc($rsWhatever) &&
$row_rsWhatever['ID'] !=57);
echo "TADA -" . $i;
?>
(assuming that ID is numeric, and that the test value
actually exists in the
database)
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"AngryCloud" <[email protected]> wrote in
message
news:g4e6ck$hrb$[email protected]..
>I will use this scenario for an example:
>
> I want to know how far down the list I will find the ID,
'57'.
>
> So I manually look at the list of results and see it is
the 25th record
> down
> on the list.
>
> How do I get my PHP script to get this number (25)
automatically?
>
Similar Messages
-
I have created Event or Alert view using a target "My.Target" which is derived from a base target "Windows Server".
All the events or alerts are captured correctly from the servers discovered by "My.Target" but the same view also shows the events and alerts from other servers which has a rule created with a base target "Windows Server".
Is there any option to filter the base target at view level other than using a custom field as it doesn't work for the alerts generated using "Monitors".
Any help would be greatly appreciated.
Thanks in advance.There is a class "My.Servers" derived from "Microsoft.Windows.Server.Computer" as below -
<TypeDefinitions>
<EntityTypes>
<ClassTypes>
<ClassType ID="My.Servers" Accessibility="Public" Abstract="false" Base="MicrosoftWindowsLibrary!Microsoft.Windows.Server.Computer" Hosted="false" Singleton="false" Extension="false">
<Property ID="Name" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" />
</ClassType>
</ClassTypes>
</EntityTypes>
</TypeDefinitions>
There is a discovery "MyServersDiscovery" to discover servers with presence of some registry key as below -
<Monitoring>
<Discoveries>
<Discovery ID="MyServersDiscovery" Enabled="true" Target="MicrosoftWindowsLibrary!Microsoft.Windows.Server.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="My.Servers">
<Property TypeID="My.Servers" PropertyID="Name" />
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="Name.AttributeDiscovery" TypeID="MicrosoftWindowsLibrary!Microsoft.Windows.FilteredRegistryDiscoveryProvider">
<ComputerName>$Target/Property[Type="MicrosoftWindowsLibrary!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<RegistryAttributeDefinitions>
<RegistryAttributeDefinition>
<AttributeName>Name</AttributeName>
<Path>SOFTWARE\MyRegKey</Path>
<PathType>0</PathType>
<AttributeType>0</AttributeType>
</RegistryAttributeDefinition>
</RegistryAttributeDefinitions>
<Frequency>300</Frequency>
<ClassId>$MPElement[Name="My.Servers"]$</ClassId>
<InstanceSettings>
<Settings>
<Setting>
<Name>$MPElement[Name="MicrosoftWindowsLibrary!Microsoft.Windows.Computer"]/PrincipalName$</Name>
<Value>$Target/Property[Type="MicrosoftWindowsLibrary!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name="SystemLibrary!System.Entity"]/DisplayName$</Name>
<Value>$Target/Property[Type="SystemLibrary!System.Entity"]/DisplayName$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name="My.Servers"]/Name$</Name>
<Value>$Data/Values/Name$</Value>
</Setting>
</Settings>
</InstanceSettings>
</Expression>
</DataSource>
</Discovery>
</Monitoring>
Created 2 views "My.Alert.View" and "My.Event.View" with Target "My.Servers" as below -
<Presentation>
<Views>
<View ID="My.Alert.View" Accessibility="Public" Enabled="true" Target="My.Servers" TypeID="SystemCenter!Microsoft.SystemCenter.AlertViewType" Visible="true">
<Category>Operations</Category>
</View>
<View ID="My.Event.View" Accessibility="Public" Enabled="true" Target="My.Servers" TypeID="SystemCenter!Microsoft.SystemCenter.EventViewType" Visible="true">
<Category>Operations</Category>
</View>
</Views>
</Presentation>
The above views display events and alerts generated by rules targeted on the serves discovered with "MyServersDiscovery" correctly.
The major issue here is - if there is a rule in same or any other management pack for which the target is "Windows Server", the alert or event generated by that rule is also shown in these views which is not expected.
It seems it is because the target for "My.Alert.View" and "My.Event.View" is "My.Servers" which is dervied from "Microsoft.Windows.Server.Computer" so by default all the rules targeted on its base class "Microsoft.Windows.Server.Computer" are also visible
here.
Is there any way to avoid this? -
Why is the file so large when I record from the microphone?
I am trying to write a program that will save incoming and outgoing voicestreams while playing them. I have been successful thus far but when I record the voice from the speaker(microphone) the file size is in the Megabyte size within a few seconds of recording! The incoming stream is more acceptable in size. I checked the files the incoming stream is 128kbps while the microphone recording is 1411kbps. I tried setting the restriction on the devicelist but that didnt work.. any ideas?
I am trying to record the outgoing voice stream when i speak into microphone to another person. I used mostly the AVTransmit 2 code to do that. The thing is i get "no processor exception" when I try to clone the data that i get from processor.getOutput. But if i were to clone the dataSource that is directly from the microphone before being processed then it works but with a much larger file size at 1120kbps. The thing is I am processing the cloneableDataSource so i am not sure what went wrong
-
Can you change the track number of a song got from the iTunes store?
I am trying to change the track numbers of stuff I have purchased from iTunes store. I have found that even if you change them in the Info tab section it doesn't actually change. I purchased a load of Muse B-sides and stuff from the iTUNES store and wanted to make them all into an album of b-sides all numbered 1 to whatever, but even if I do change the number like I said, when I put it onto my ipod it still seems to keep the track number it had originally. Say I purchased track 2 of a single. But on the cd I burn I want it to be track 7. So I burn the cd with all the tracks in the order I want them with Itunes ( having changed their track numbers as well in the info section ) but when I rip the cd back into Itunes and put it onto my pod the track that was track 7 on the cd ( but was originally track 2 off a single i purchased ) becomes track 2 again when it on my ipod? Any way round this?
Make a playlist and put them in whatever order you like within that playlist.
Cheers!
-Bryan -
How to generate the batch number for group of records
Hi All,
requirement: i have created one sequence to generate the batch numbers.i have to get the nextval of the sequence for batch number (this column is not part of the table. its dynamic column/alias column) only for every 50000 records of a table.
detail description:
for example, if i have 10 records in a table. And, if i want to generate the batch number for every 2 records, then the output should look like belo.
batch-number qty
1 10
1 20
2 30
2 40
3 50
3 60
4 70
4 80
5 90
5 100
Please help me on this. Please let me know if you need more info.one more update on the above request. this has to be done using SQL query only.
-
Can I remove a SPECIFIC file from the "Recents" list?
As far as I can see, Adobe Reader for Android has only the option of clearing ALL the files in the "Recents" list. It doesn't have the option of removing a specific file from the "Recents" list.
Maybe I'm just missing the option I'm talking about or Adobe Reader doesn't really have that feature.
Sensible answers to my question will be greatly appreciated. Thanks!Hi iSTULIN
I assume you can delete the complete list, not the single file ...
Please check the below link : http://blogs.adobe.com/readermobile/2011/09/09/faqs-for-adobe-reader-on-android/
You can raise a feature request on the below link : https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform -
Retrieving the row number where a certain value exists
Hi,
I wanted to find out if there is a way to retrieve the row number of a row where a certain value exists. For example, if I had a query
Create or replace Procedure p1
IS
v_Stmt varchar2(100);
BEGIN
v_Stmt := 'Select * from emp where lname = 'Davis'';
Execute Immediate v_Stmt;
END;
SQL> exec p1;
Then, I would like to find out that this name is on row 3.
Can anyone tell me how this can be done?
Thanks in advance.
Sincerely,
Nikhil Kulkarnitheres is no rownum related to a particular row. A rownum is a pseudocolumn which value may be different for the same row depending on the query you do. What you can use is the rowid which is the row's address.
HTH
Maurice -
How to display the rows number of times by giving the column values?
Hi All,
I want to display the rows number of times as the value exists in num column in the below query
with t AS
( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
UNION ALL
SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
UNION ALL
SELECT 'krishna' NAME, 'hyd' LOC, 1 NUM FROM DUAL )
SELECT T.* FROM T
CONNECT BY ROWNUM <= NUM
Expected output:
venkatesh hyd 2
venkatesh hyd 2
prasad hyd 3
prasad hyd 3
prasad hyd 3
krishna hyd 1Edited by: Nag Aswadhati on Nov 1, 2012 12:34 AMNag Aswadhati wrote:
Hi All,
I want to display the rows number of times as the value exists in num column in the below query
Expected output:
venkatesh hyd 2
venkatesh hyd 2
prasad hyd 3
prasad hyd 3
prasad hyd 3
krishna hyd 1Using Connect By:-
with t AS
( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
UNION ALL
SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
UNION ALL
select 'krishna' name, 'hyd' loc, 1 num from dual )
select t.name, t.loc
from t
connect by level <= num
and name = prior name
and (prior sys_guid() is not null);
NAME LOC
krishna hyd
prasad hyd
prasad hyd
prasad hyd
venkatesh hyd
venkatesh hyd
6 rows selected -
How can I get the row number of display automatically on a table?
I have a table of measurements, and I would like the row number to be displayed on each row. The challenge is that each time I run the program, the total number of rows will be different, so I would like the numbers to update every time I run the program based on the current number of rows.
I have attached a picture to illustrate what I am trying to do.
Solved!
Go to Solution.
Attachments:
picture of table.JPG 70 KBFind the attached example (saved in version 2009), and you can extract what you need for your code...!!
I am not allergic to Kudos, in fact I love Kudos.
Make your LabVIEW experience more CONVENIENT.
Attachments:
Example (Enter Row Header).vi 12 KB -
Hi list,
does any one know how I can get the row number the same as what I have in column rowno?
thanks
Arvin
REATE TABLE dbo.temptable
( y int NOT NULL,
e int not null,
c int not null,
rowno int not null)
/* insert values */
INSERT INTO dbo.temptable(y,e,c,rowno ) VALUES
(1,1,1,1),
(1,1,2,1),
(1,1,3,1),
(1,20,1,2),
(1,20,2,2),
(1,20,3,2),
(1,3,1,3),
(1,3,1,3),
(2,1,1,1),
(2,1,1,1),
(2,2,1,2),
(2,2,1,2);You may update your rownumber column with Column "e".
But why do you duplicate your data? May be there is no particular reason, you may be wasting space for it
Try the below:
CREATE TABLE dbo.temptable
( y int NOT NULL,
e int not null,
c int not null,
ronum int null)
INSERT INTO dbo.temptable(y,e,c ) VALUES
(1,1,1),
(1,1,2),
(1,1,3),
(1,20,1),
(1,20,2)
select * from temptable
update dbo.temptable Set ronum=e
Select * From dbo.temptable
DRop table dbo.temptable -
Calculating the row number with DAX
Hello,
Can somebody help me to obtain the row number in a calculated column using DAX (PowerPivot 2013) ?
I do not have any column that would contain unique values (would be easy in that case !). I just want to obtain a different value in each row.
Thank you.Hi DP17000,
According to your description, you need to add a column with the RowNumber to your Pivot table by using DAX, right?
Based on my tested, we can use a ranks function to achieve your requirement.
=RANKX(case0305,[amount],[amount],0,dense)
Reference
https://msdn.microsoft.com/en-us/library/gg492185.aspx?f=255&MSPPError=-2147217396
http://ayadshammout.com/2013/02/19/dax-rankx-function-scenarios/
Regards,
Charlie Liao
TechNet Community Support -
Add dynamic buttons to each report row and bind the row data to buttons specific to that row
I have a page with a form at the top and a report at the bottom which is tied to a table. I need to add a pair of buttons for each row of the table and add dynamic actions for these buttons. I need to submit the data corresponding to the row to a REST service and refresh the table/row. I know it is possible to add ajax call and refresh the table after the response is received. But I am not sure how I can dynamically include a pair of buttons on each row and have the access the data corresponding to the record when a particular button is clicked. I was not able to find such a feature using the help page. Can you please let me know if this is possible. Thanks in advance.
Below is the representation of how I need the page to look like.
Col 1
Col 2
Col 3
data 1
data 21
data 31
Button 1
Button 2
data 2
data 22
data 32
Button 1
Button 2
data 3
data 23
data 33
Button 1
Button 2
data 4
data 24
data 34
Button 1
Button 2
I should be able to access data 1, data21, data 31 from button 11 and button21 etc.select data1,
data2,
data3,
null button1,
null button2,
rowid r_id
from .....
If you edit the column for button1 and navigate to the Column Formatting region you can create your button here, several different ways. You will need to play around with how you prefer. See below:
<input class="button1" type="button" id="#R_ID#" value="label for the button" /> or <button id="#R_ID#">label for button</button> or you could use <a> and apply css of your theme.
You also create both buttons in a single column. From here you can reference any of the columns from your select by using the #COLUNMNAME# format (as I did with R_ID).
You will next need to something similar for all columns you want to be able to grab when you click the buttons. See below:
--- This would be for data1 column
<span id="D1-#R_ID#">#DATA1#</span>
You would do these for each column that you want access to when button clicked as mentioned above. You could bypass this step and use jquery to traverse the DOM using .closest() and .find() and give each column a distinct class. Is is your preference.
You would then create a dynamic action triggered when .button1 is clicked. Now that you have that object you can get the id of the triggering object which would be your r_id and from there you can access all your individual data points(all this done in a javascript in the dynamic action) and assign to hidden items on your page. The next step of that dynamic action you could execute pl/sql and pass those in page items.
Hope that all makes sense.
David
Message was edited by: DLittle
Just as a bit of clarification: the r_id column does not have to be rowid, but it does need to be unique for each row return. You could use your primary key or rownum. Whatever works for your scenario. -
I retrieved my serial number for Acrobat 8 Standard from Adobe because my system crashed. I went to the downloads and can only retrieve Acrobat 8 Pro. The installer will not take my serial number what can I do?
Hi floyd99,
You can download Acrobat 8 Standard from : https://files.acrobat.com/a/preview/80aa8c58-2951-494e-808a-fb61a6b4aa29
Reagrds,
Rave -
TableView -- get the row number of the top most current visible row
Is there any way to get the row number of the top most visible row, and or bottom most visible row in TableView?
If you already know the document's name, the sheet's name and the table's name, the easy way is :
--Here you may replace the three values by the current ones
set dName to 1
set sName to 1
set tName to 1
tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
tell first cell of the selection range to set {rowNum1, columnNum1} to {address of its row, address of its column}
tell last cell of the selection range to set {rowNum2, columnNum2} to {address of its row, address of its column}
end tell
Yvan KOENIG (VALLAURIS, France) mercredi 9 février 2011 17:22:21 -
About the row number of the datagrid[Flex 2.0 beta3]
I want to add a column to the datagrid,which will indicates
the row number.Who can tell me how to do it?
And how to keep the number's sequence unchanged when the
header of one of other columns is cliked to sort the
data?If I understand this correctly. Then would it not make more
sense to say in
the LiveDocs --
makeObjectsBindable - After the remote call (RPC, HTTP, SOAP,
etc) returns
its value. Flex tries to automatically convert the result
into an
ArrayCollection (if it looks like an array, even if it was
XML) [Or
others???] format. This automatic conversion controlled by
the
makeObjectBindable property. If false, Flex does not attempt
the conversion
and the result will be in (xml?) format.
"peterent" <[email protected]> wrote in
message
news:eali1i$1q9$[email protected]..
> Results that come back which look like Arrays will be
turned into
> ArrayCollections automatically. Since most people
immediate turn an Array
> into
> an ArrayCollection, we went ahead and did it for you.
Try getting rid of
> your
> new ArrayCollection in the result handler.
>
Maybe you are looking for
-
I had to get a new hard drive and some of my pictures show up but when I go to click on them to open them there is a triangle with an exclamation mark. Did I loose those pictures or is there a problem with iphoto
-
I can't enter to youtube? Why can't i use the internet in my campus from college?
i can't enter to youtube? Why can't i use the internet in my campus from college?
-
Theirs no point in upgrading to CC, CS6 vs CC
So, I have been using adobe products for many years and have purchased every adobe product from CS2 and lately I have been asking myself the question should I upgrade my CS6 to CC, and to be honest there is no way in hell that I will. To be frank I t
-
Commit Completes although current online redo log file have been removed.
Although i have removed current online redo log file in linux os (Oracle Linux),when i type "commit" it says that "commit complete". Is this fair for this princip?*:" if Only when all redo records associated with a given transaction are safely on dis
-
Is there a way using itunes to copy only a portion of a song? Thanks for any help.