hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Mysql Problem: How to only view some text of a file
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Mysql Problem: How to only view some text of a file

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 06-03-2004, 09:46 PM
Barti1987 Barti1987 is offline
Web Hosting Master
 
Join Date: Mar 2004
Location: USA
Posts: 4,342
*

Mysql Problem: How to only view some text of a file


just like some news.

they only show you a little start and then you will have to click here to get all the text..

on more thing, the selct based on the date is not working..

i made this query:

Code:
SELECT * FROM news WHERE `group_id`='1' AND `start` >= '2004-06-03' AND `stop` <= '2004-06-03' AND `status`='Active'
I have 2 fileds like this:
Code:
1 - 1 - New Airplanes Inventory! We just recireved a great new airplanes from amana... - 2004-06-01 - 2005-06-03  - Active 
2 - 1 - the Other Sample Inventory We just recireved a great new airplanes from amana... - 2004-06-13 - 2005-06-13 - Active
The - separates each field...

first date is the start, the seoncd is the date, all fields are in date format xxxx-xx-xx

thnx for any help

peace,

__________________
Testing 1.. Testing 1..2.. Testing 1..2..3...

Reply With Quote


Sponsored Links
  #2  
Old 06-03-2004, 10:26 PM
Barti1987 Barti1987 is offline
Web Hosting Master
 
Join Date: Mar 2004
Location: USA
Posts: 4,342
Lol....

I should always think before doing soemthine

I did this :p

PHP Code:
$all_length strlen($get_news_line[3]);
$half_length ceil($all_length 2);
$new_show explode(' ',$get_news_line[3]);

$the_len 0;
$i 0;

while(
$the_len $half_length){
        echo 
$new_show[$i] . ' ';
        
$the_len $the_len strlen($new_show[$i]);
        
$i++;

was I slick :p

__________________
Testing 1.. Testing 1..2.. Testing 1..2..3...

Reply With Quote
  #3  
Old 06-03-2004, 10:29 PM
Barti1987 Barti1987 is offline
Web Hosting Master
 
Join Date: Mar 2004
Location: USA
Posts: 4,342
But hay guys..

im still having problem on the date thing??

I cant keep on getting them between those dates

tnx

__________________
Testing 1.. Testing 1..2.. Testing 1..2..3...

Reply With Quote
Sponsored Links
  #4  
Old 06-03-2004, 11:01 PM
w3needs w3needs is offline
WHT Addict
 
Join Date: Aug 2003
Location: PA
Posts: 110
At first glance, it looks like your query is not looking for ayear ahead. Instead, it is still listed as '2004', not 2005.

I personally use a unix timestamp for easier alts later on. Then, I slip it into a formatting function. For php, I use mktime() to store the timestamp, then date("Y-M-d",$stored_time) for retrieval...jsut a little extra that I'm sure you are aware of.

But, like I said, it looks like your year is a little off.

Also, I usually do this for my concatated strings...
PHP Code:
$maxlength 255;
$short_str substr($string,0,$maxlength);
$string $short_str ."..."
You could also...
PHP Code:
$string substr($str,0,255) . "..."
I would also throw in checcks to see how long the news items is compared to what you want the max length of the news item to be displayed in the preview state.

Anyhow, babbling right now. We just got back from a graduation of my brother's and everyone is still rev'ved!

Later, and I hope something in post helps!

Night,
Jim

Reply With Quote
  #5  
Old 06-03-2004, 11:18 PM
Barti1987 Barti1987 is offline
Web Hosting Master
 
Join Date: Mar 2004
Location: USA
Posts: 4,342
Quote:
Originally posted by w3needs
At first glance, it looks like your query is not looking for ayear ahead. Instead, it is still listed as '2004', not 2005.

I personally use a unix timestamp for easier alts later on. Then, I slip it into a formatting function. For php, I use mktime() to store the timestamp, then date("Y-M-d",$stored_time) for retrieval...jsut a little extra that I'm sure you are aware of.

But, like I said, it looks like your year is a little off.

Also, I usually do this for my concatated strings...
PHP Code:
$maxlength 255;
$short_str substr($string,0,$maxlength);
$string $short_str ."..."
You could also...
PHP Code:
$string substr($str,0,255) . "..."
I would also throw in checcks to see how long the news items is compared to what you want the max length of the news item to be displayed in the preview state.

Anyhow, babbling right now. We just got back from a graduation of my brother's and everyone is still rev'ved!

Later, and I hope something in post helps!

Night,
Jim
Hay thank you for answering..

It did work....

Thanks alot..

About the unix time stamp I will try to get into it more details hopefully on my next project..

I just started with this date, man I use to use varchar to hold off date (it use to be hell amount of work)

I seem to be evolving to the best thou..

Thanks again, I am going home will look into what you said in more detalis tommorow..

Also say happy graduation to your brother, hope you guys have a great time

Peace,

__________________
Testing 1.. Testing 1..2.. Testing 1..2..3...

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Are you ready for Speed Networking at WHIR Events? Blog 2013-01-18 07:00:04
Web Host Rackspace Launches Private Beta for MySQL Cloud Database Web Hosting News 2011-12-01 21:09:51
Parallels Now Offering Licenses for CloudLinux OS Web Hosting News 2011-10-26 17:29:25
Web Hosting Sales and Promos Roundup - October 7, 2011 Web Hosting News 2011-10-07 19:56:18
SingleOS Launches Fuscan Linux Cloud 2.0 Web Hosting News 2011-08-12 19:09:05


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?