Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:47:08+00:00 2026-06-03T14:47:08+00:00

This code selects the first five rows based on the criteria expressed in the

  • 0

This code selects the first five rows based on the criteria expressed in the select statement then it fetches the data from the columns specified by number then it echos the returned data to the page.

if( $connect === false )
{
  echo "Could not connect.\n";
  die( print_r( sqlsrv_errors(), true));
}

/* Select Statement */
$select = "SELECT TOP(5)name, lv FROM Character WHERE lv > 0 AND name NOT LIKE '%@%' AND name NOT LIKE '%[GM]%'
AND name NOT LIKE '%[GA]%' AND name NOT LIKE '%[DEV]%' ORDER BY lv DESC ";

/* Execute the query. */
$query = sqlsrv_query( $connect, $select);

if ( $query )
{
} 
else 
{
  echo "Error in statement execution.\n";
  die( print_r( sqlsrv_errors(), true));
}

/* Iterate through the result set printing a row of data upon each
iteration.*/
while( $row = sqlsrv_fetch_array( $query, SQLSRV_FETCH_NUMERIC))
{
 echo "<b>Name</b>: &nbsp;".$row[0]." <br/>";
 echo "<b>Level</b>: &nbsp;".$row[1]."<br/>";
 echo "<br/>";

}

/* Free statement and connection resources. */
sqlsrv_free_stmt( $query);
sqlsrv_close( $connect);
?>

What I need it to do is the echoed data, must have a number, for example: higher level will be 1st and so on. This already orders the data by level, but I can’t manage to echo a number for each name. My thought was to making them to appear inside an ol and each user name will be inside a li so by default you can style list to display numbers in order. Then I can’t manage to think how to do that. Could you give me some hints? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:47:09+00:00Added an answer on June 3, 2026 at 2:47 pm

    I think this is what you’re looking for. It will print a number before each name.

    $counter = 1;
    while( $row = sqlsrv_fetch_array( $query, SQLSRV_FETCH_NUMERIC))
    {
     echo $counter.". <b>Name</b>: &nbsp;".$row[0]." <br/>";
     echo "<b>Level</b>: &nbsp;".$row[1]."<br/>";
     echo "<br/>";
     $counter++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is this good code? can it be simplified somehow? SELECT u.id,u.title,u.title,u.first,u.last FROM (((tblusers u
In code-behind I can do this to select something: // Select item in first
This code selects the nodes, I want to work on...: <xsl:variable name=rootTextpageNode select=$currentPage/ancestor-or-self::node [@level
i develop this code: SELECT COUNT(NewEmployee.EmployeeID), NewEmployee.EmployeeId,EmployeeName FROM NewEmployee INNER JOIN NewTimeAttendance ON NewEmployee.EmployeeID
now i use this code: $welcome_text = mysql_query(SELECT * FROM `text` WHERE `name` =
I have this line of code that selects a workflow status and then gets
This code doesn't work: return this.Context.StockTakeFacts.Select(stf => ((stf.StockTakeId == stocktakeid) && (stf.FactKindId == ((int)kind)))).ToList<IStockTakeFact>();
This code didn't works as expected. I want to select all the posts that
I have this code <Select> <option value=-1>Select</option> <option value=6>kasper </option> <option value=13>adad </option> <option
I currently am using this JavaScript code snippet to select 3 checkboxes at a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.