Welcome to HostingForumz.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Limit Rows Returned ASP and MySQL

 
   Web Hosting Problem Solving Community! (Home) -> Webmaster RSS
Related Topics:
Size Limit With MySQL ? - Is there a or practical limit on the size of an MySQL database that is used to power a content system (e.g. WordPress or Joomla)? For example, 50,000 pages, at 25K to 40K per page, would be about a gig and a half total. Would..

Help with MySQL - hi i am building a site from my pc using APACHE/ and all that other stuff need a little help... Now i want to add some php stuff AND WORKS( , but this needs mySQL AND WORKS( how would i setup the databases (named: dbase) : before on..

PHP and... XML or MySQL? - A lot of seems to be out there regarding the use of PHP and MySQL together. I can't find many books about PHP and XML. Is there a reason for this? Or is it just because PHP has only recently supported XML in a thorough way? I guess what..

mysql help please? - In how do I find all entries in the table phrase that contains GAS? I tried SELECT * FROM phrase WHERE varname = GAS; but that doesnt work I installed a article hack on my vbulletin forum and it didnt work and the uninstall script dodnt..

adsense limit? - I was doing a test and even though I had more only three adsense blocks showed up on the page...? has anyone else this? Is that the limit they enforce remotely ? Heidi
Next:  W3WP.exe crashes - need help interpreting log  
Author Message
no1

External


Since: Jan 24, 2004
Posts: 95



(Msg. 1) Posted: Wed Feb 06, 2008 6:05 pm
Post subject: Limit Rows Returned ASP and MySQL
Archived from groups: alt>www>webmaster (more info?)

I am trying to set a limit of rows displayed
using ASP and MySQL database.

I keep reading that LIMIT should work

I have tried

SELECT * FROM tblCompany LIMIT 2 WHERE strCountry LIKE '%"

but just get an error.
How can I just set an amount of results to display?

TIA.

 >> Stay informed about: Limit Rows Returned ASP and MySQL 
Back to top
Login to vote
jstucklex

External


Since: Jul 14, 2003
Posts: 1507



(Msg. 2) Posted: Wed Feb 06, 2008 6:05 pm
Post subject: Re: Limit Rows Returned ASP and MySQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

T.J. wrote:
> I am trying to set a limit of rows displayed
> using ASP and MySQL database.
>
> I keep reading that LIMIT should work
>
> I have tried
>
> SELECT * FROM tblCompany LIMIT 2 WHERE strCountry LIKE '%"
>
> but just get an error.
> How can I just set an amount of results to display?
>
> TIA.
>
>
>

You are mixing ' and "". Also, LIMIT goes after the WHERE clause.

BTW - '%' means zero or more characters. LIKE '%' means get every row
which doesn't have a NULL value in that column. If the column is
defined as NOT NULL, it is a no-op. If the column can contain NULL
values, then WHERE strCountry IS NOT NULL would be more efficient.

And these questions are best answered on comp.databases.mysql, where the
mysql experts hang out.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex RemoveThis @attglobal.net
==================

 >> Stay informed about: Limit Rows Returned ASP and MySQL 
Back to top
Login to vote
John Bokma

External


Since: Apr 27, 2005
Posts: 593



(Msg. 3) Posted: Wed Feb 06, 2008 6:05 pm
Post subject: Re: Limit Rows Returned ASP and MySQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"T.J." <no1.DeleteThis@home.invalid> wrote:

> I am trying to set a limit of rows displayed
> using ASP and MySQL database.
>
> I keep reading that LIMIT should work
>
> I have tried
>
> SELECT * FROM tblCompany LIMIT 2 WHERE strCountry LIKE '%"
>
> but just get an error.
> How can I just set an amount of results to display?


SELECT * FROM table WHERE condition LIMIT 2

See also the advice I gave to Tina earlier on, unless this is some home
tinker project. There are several good books on MySQL. I recommend to
study one before you proceed. A database is an extremely good tool to
shoot yourself and many others in both feet.

--
John Bokma http://johnbokma.com/
 >> Stay informed about: Limit Rows Returned ASP and MySQL 
Back to top
Login to vote
no1

External


Since: Jan 24, 2004
Posts: 95



(Msg. 4) Posted: Wed Feb 06, 2008 6:05 pm
Post subject: Re: Limit Rows Returned ASP and MySQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Jerry Stuckle" <jstucklex.TakeThisOut@attglobal.net> wrote in message
news:XfadndhuEpGEijfanZ2dnUVZ_vumnZ2d@comcast.com...
> T.J. wrote:
>> I am trying to set a limit of rows displayed
>> using ASP and MySQL database.
>>
>> I keep reading that LIMIT should work
>>
>> I have tried
>>
>> SELECT * FROM tblCompany LIMIT 2 WHERE strCountry LIKE '%"
>>
>> but just get an error.
>> How can I just set an amount of results to display?
>>
>> TIA.
>
> You are mixing ' and "". Also, LIMIT goes after the WHERE clause.
>
> BTW - '%' means zero or more characters. LIKE '%' means get every row
> which doesn't have a NULL value in that column. If the column is defined
> as NOT NULL, it is a no-op. If the column can contain NULL values, then
> WHERE strCountry IS NOT NULL would be more efficient.
>
> And these questions are best answered on comp.databases.mysql, where the
> mysql experts hang out.
>

Thank you.
That wasn't the actual code I was using, just a
snippet of it.

I have now got it working by moving LIMIT
right to the end of the WHERE and after
the ORDER BY
 >> Stay informed about: Limit Rows Returned ASP and MySQL 
Back to top
Login to vote
no1

External


Since: Jan 24, 2004
Posts: 95



(Msg. 5) Posted: Wed Feb 06, 2008 6:05 pm
Post subject: Re: Limit Rows Returned ASP and MySQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"John Bokma" <john.DeleteThis@castleamber.com> wrote in message
news:Xns9A3C923AEC62Dcastleamber@130.133.1.4...
> "T.J." <no1.DeleteThis@home.invalid> wrote:
>
>> I am trying to set a limit of rows displayed
>> using ASP and MySQL database.
>>
>> I keep reading that LIMIT should work
>>
>> I have tried
>>
>> SELECT * FROM tblCompany LIMIT 2 WHERE strCountry LIKE '%"
>>
>> but just get an error.
>> How can I just set an amount of results to display?
>
>
> SELECT * FROM table WHERE condition LIMIT 2
>
> See also the advice I gave to Tina earlier on, unless this is some home
> tinker project. There are several good books on MySQL. I recommend to
> study one before you proceed. A database is an extremely good tool to
> shoot yourself and many others in both feet.
>

Thanks John,
I moved the LIMIT to after the WHERE and
ORDER BY and it works how I want it to now.
 >> Stay informed about: Limit Rows Returned ASP and MySQL 
Back to top
Login to vote
John Bokma

External


Since: Apr 27, 2005
Posts: 593



(Msg. 6) Posted: Wed Feb 06, 2008 9:04 pm
Post subject: Re: Limit Rows Returned ASP and MySQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"T.J." <no1.DeleteThis@home.invalid> wrote:

>
> "John Bokma" <john.DeleteThis@castleamber.com> wrote in message
> news:Xns9A3C923AEC62Dcastleamber@130.133.1.4...
>> "T.J." <no1.DeleteThis@home.invalid> wrote:
>>
>>> I am trying to set a limit of rows displayed
>>> using ASP and MySQL database.
>>>
>>> I keep reading that LIMIT should work
>>>
>>> I have tried
>>>
>>> SELECT * FROM tblCompany LIMIT 2 WHERE strCountry LIKE '%"
>>>
>>> but just get an error.
>>> How can I just set an amount of results to display?
>>
>>
>> SELECT * FROM table WHERE condition LIMIT 2
>>
>> See also the advice I gave to Tina earlier on, unless this is some home
>> tinker project. There are several good books on MySQL. I recommend to
>> study one before you proceed. A database is an extremely good tool to
>> shoot yourself and many others in both feet.
>>
>
> Thanks John,
> I moved the LIMIT to after the WHERE and
> ORDER BY and it works how I want it to now.

You're aware that you can specify 2 values after LIMIT, one is the number
of rows, the other is the offset (in case you want the next 2 rows or so).

--
John Bokma http://johnbokma.com/
 >> Stay informed about: Limit Rows Returned ASP and MySQL 
Back to top
Login to vote
John Bokma

External


Since: Apr 27, 2005
Posts: 593



(Msg. 7) Posted: Wed Feb 06, 2008 9:04 pm
Post subject: Re: Limit Rows Returned ASP and MySQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"T.J." <no1 DeleteThis @home.invalid> wrote:

> That wasn't the actual code I was using, just a
> snippet of it.

Always post real code. Otherwise you end up with people who talk about
what's wrong with your code, instead of your actual question. (I just
ignored the code, I've been too long in programming related groups).

--
John Bokma http://johnbokma.com/
 >> Stay informed about: Limit Rows Returned ASP and MySQL 
Back to top
Login to vote
no1

External


Since: Jan 24, 2004
Posts: 95



(Msg. 8) Posted: Wed Feb 06, 2008 9:04 pm
Post subject: Re: Limit Rows Returned ASP and MySQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"John Bokma" <john DeleteThis @castleamber.com> wrote in message
news:Xns9A3CB8CB8E9F6castleamber@130.133.1.4...
> "T.J." <no1 DeleteThis @home.invalid> wrote:
>
>>
>> "John Bokma" <john DeleteThis @castleamber.com> wrote in message
>> news:Xns9A3C923AEC62Dcastleamber@130.133.1.4...
>>> "T.J." <no1 DeleteThis @home.invalid> wrote:
>>>
>>>> I am trying to set a limit of rows displayed
>>>> using ASP and MySQL database.
>>>>
>>>> I keep reading that LIMIT should work
>>>>
>>>> I have tried
>>>>
>>>> SELECT * FROM tblCompany LIMIT 2 WHERE strCountry LIKE '%"
>>>>
>>>> but just get an error.
>>>> How can I just set an amount of results to display?
>>>
>>>
>>> SELECT * FROM table WHERE condition LIMIT 2
>>>
>>> See also the advice I gave to Tina earlier on, unless this is some home
>>> tinker project. There are several good books on MySQL. I recommend to
>>> study one before you proceed. A database is an extremely good tool to
>>> shoot yourself and many others in both feet.
>>>
>>
>> Thanks John,
>> I moved the LIMIT to after the WHERE and
>> ORDER BY and it works how I want it to now.
>
> You're aware that you can specify 2 values after LIMIT, one is the number
> of rows, the other is the offset (in case you want the next 2 rows or so).
>

Yes, I'm aware of that thanks.
I'm only doing something really basic so
are just using LIMIT 0, 10
 >> Stay informed about: Limit Rows Returned ASP and MySQL 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting Problem Solving Community! (Home) -> Webmaster All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]