473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Shortening a fetched array

Hi, i'm unsure of the versions of MySQL and PHP I'm using (although my webhost 'guarantees' the latest), but I don't think the answer would vary that much between versions.
Now to the point:
I'm trying to echo text fetched from a database into a 128px width column, which doens't always fit. I'd like to know how to shorten the results of an array using '...'s like: 'Amer...' or 'Urag...' instead of 'America' or 'Uraguay'.

Thank you,
ViperBlade
Feb 24 '07 #1
3 1310
Motoma
3,237 Expert 2GB
Hi, i'm unsure of the versions of MySQL and PHP I'm using (although my webhost 'guarantees' the latest), but I don't think the answer would vary that much between versions.
Now to the point:
I'm trying to echo text fetched from a database into a 128px width column, which doens't always fit. I'd like to know how to shorten the results of an array using '...'s like: 'Amer...' or 'Urag...' instead of 'America' or 'Uraguay'.

Thank you,
ViperBlade
Welcome to theScripts ViperBlade!
This task will be quite difficult unless you are using a monospaced font.
Feb 24 '07 #2
Welcome to theScripts ViperBlade!
This task will be quite difficult unless you are using a monospaced font.
True, but i'll be using Lucidia Sans Console. Do you have any ideas? I know it's
possible because phpMyAdmin shortens certain fields with '...'s.

Thanks for the welcome,
ViperBlade
Feb 24 '07 #3
Motoma
3,237 Expert 2GB
True, but i'll be using Lucidia Sans Console. Do you have any ideas? I know it's
possible because phpMyAdmin shortens certain fields with '...'s.

Thanks for the welcome,
ViperBlade
In order to fit it correctly inside a certain pixel width, you would have to calculate the width of each character, and the truncate the string, and append "..."
Feb 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kaptain kernel | last post by:
how does one shorten an array based on a key value. Say I have this: array("Car1"=>"Porsche","Car2"=>"Merc","Car3"=>"Ford","Car4"=>"Toyota"); and I want to pop "Car2" out of the array,...
4
by: Dariusz | last post by:
I have a guestbook on one of my sites where the entires are formatted to be x pixles in width. Now the text is input and output from a "blob" field from a database... but when people input long...
1
by: Vdasu | last post by:
What is the max number of records can be fetched in oracel in one call ? I have read it as 64k. Is this correct ?
11
by: rukkie | last post by:
I have a MySql db, in which I search for values to populate a selection box, as follows : <select size="1" name="customer"> <option selected="selected">(not queried)</option> <?php...
5
by: nazeers | last post by:
Hi All, Earlier I haved posted the issue for fetching the base URLs from the xml file and got some valubale help from this Forum. With the given inputs ... i was able to code to fetch all the...
3
by: Ifoel | last post by:
Hi all pls help me How to know "HOW MANY SECOND" we fetched the rows of the record MySQL via Visual Basic 6...? Sample: 321 rows Fetched in 0,234s -> i need this field to load on the FORM...
1
by: preejith | last post by:
Error Code : 1329, No data - zero rows fetched, selected, or processed. MYSQL I am getting the following error while running a stored procedure in mysql5.0 Error Code : 1329 No data - zero rows...
1
by: gubbachchi | last post by:
Hi, For my project I have a "add" button, upon clicking it, it will take the user to next page where there will be a text box and list of data displayed below it which is fetched from mysql...
2
by: jaguarpk786 | last post by:
ive this code which fetches track title and artist name from the database ,,,, i want to insert radio button in front of each fetched row through which user wud b able to select a song which he wants...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.