My table gets its information from a Mysql database online. I'm not sure which would be quicker to retrieve the row that contains the information specified.

EG.

table1

Name________Age

John_________5
Joe__________20

At this moment i have a while loop that looks for john and gives me the row. But is running a script to my database quicker?

By the way my table is in alphabetical order. I'm looking for a quicker way to keep my program running better. Thanks

Edited 5 Years Ago by ninjatalon: n/a

if you loop through the whole records then you will have to get all the records from database and it will take a lot of time( as your database is on internet).

i suggest you write the query such as it retrieve as much less records as possible.

Let's Say : you are trying to find record in which the name is "john".

so you can write the query like:

select * from table1 where name='john'

this will fetch only one record and it will be lot faster.

Second thing is if you dont know the whole name and you want to list only those records with name starting with "j"
then you can write a query like

select * from tabel1 where name LIKE 'j%'

this will get only those records in which name starts with alphabet "j".

i have the datatable stored inside a table variable when the program starts up.
What i'm worried about is loss of connectivity for the user and some users have 56k connections. How does a mysql script look up a the row for which child im looking for? Like does it use a binary search or some better way?

I have my function to detect the row for every textbox validation which is upwards up of 20 validations. I hope that mysql script is the best to go with.

SO using "select * from table1 where name='john'" will give me the row count i need?

This question has already been answered. Start a new discussion instead.