Forum Moderators: coopster & phranque

Message Too Old, No Replies

MySQL Results

I only one part of it?

         

Knowles

1:22 am on Aug 16, 2002 (gmt 0)

10+ Year Member



I am trying to pull just a portion of the content stored in the DB. I am pulling the record with 3 parts. I want the 3rd part to be limited in length is there a way to do this? I have searched on mysql.com and php.net and I couldnt find anything that would do this. I have even pulled out the books on this! Any help? Ideas?

amoore

1:39 am on Aug 16, 2002 (gmt 0)

10+ Year Member



do you mean that you only want the first few characters of a field? try:
select left(foo, 50) from bar;
to get the first 50 characters of the foo field from the bar table.

Do you mean that you only want the first few entries? try:
select foo from bar order by foo limit 50;
to get the first 50 (alphabetically or numerically or whatever) foo fields from bar table.

Is that what you're looking for?

Knowles

1:45 am on Aug 16, 2002 (gmt 0)

10+ Year Member



amoore thanks for the reply, the first one is what I am looking for.

I tried it and it didnt return any data now. I need to pull foo, foo1, foo2 and foo3 but limited to 50 charaters. Does that make sense?

I tried select left(foo, foo1, foo2, foo3, foo4 50) from bar, as well but it didnt work either.

redzone

3:31 am on Aug 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Knowles,

Did you try:

select left(foo,50), left(foo1,50), left(foo2,50), left(foo3,50), left(foo4,50) from bar order by bla-bla

Knowles

12:10 pm on Aug 16, 2002 (gmt 0)

10+ Year Member



Thank you redzone that did it. Thanks for all yalls help! :)

redzone

2:24 pm on Aug 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SQL is so picky at times, isn't it? :)

I've driven myself "bonkers" before, on some "Join" statements, and using multiple result sets, only to find out, I did something stupid at the very beginning of the code... LOL

Knowles

2:33 pm on Aug 16, 2002 (gmt 0)

10+ Year Member



You are telling me, but I think its more the whole web design that’s picky! I redesigned this site yesterday due to getting a 404 error when I was trying to pass a varabile. I finally figured out what the problem was. I was putting a / in front of a link. I spent about 3 hours trying to figure this out!

redzone

10:28 pm on Aug 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Knowles,

Man do I know where you are coming from!

We do everything in Native VB6.0 & SQL7.0.. Scripting languages choke on us, for the type of CGI we are doing.

One of the few smart things I've done, was install the web server software on my development box, allowing me to program, and hit "LocalHost" from a browser on the same box.. Cut my development time down quit a bit.

Debugging CGI is a bear, especially for syntax and URL structuring errors, like the one you mentioned..