473,396 Members | 2,111 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,396 software developers and data experts.

mysql query split into array

Hi All,
I fetched a sequence from my database into mysql_query and then I want to split in the group of 60 and print it. I am using while loop and pushing into array and then trying to split it and print it on the web page but its nor working????

here is the code:
Expand|Select|Wrap|Line Numbers
  1. $res_fasta = mysql_query($fasta) or die('Query failed: ' . mysql_error());
  2.  
  3. while($seq = mysql_fetch_array($res_fasta))
  4. {
  5.     array_push($arr,"{$seq['sp_fasta']}");
  6. }
  7.  
For example: if the sequence is of 500 charecters and then i am trying to print it 60 charecters per line till the end of the sequence.
but when i echo the count in array ite gives me 1 as the value???

confused, any help....

thanks
kumar
Sep 14 '07 #1
5 4558
Atli
5,058 Expert 4TB
Hi kumar,

Have you considered using the substr() function? Or maybe the wordwrap() function?

P.S Please use [code] tags when posting code!
Sep 14 '07 #2
Thanks Atli for your help..

the wordwrap is working and i think I will also try with substr...

thanks once again for the help....

kumar
Sep 14 '07 #3
Atli
5,058 Expert 4TB
Glad I could help :)
Please don't hesitate to post again if you have any more questions or problems we can help you with!
Sep 14 '07 #4
Thanks,
I am able to generate the string of 60 characters in each new line but the edges are not smooth, i tried to use HTML "align = justify" attribute but no success.
here is the output:
MRPSGTAGAALLALLAALCPASRALEEKKVCQGTSNKLTQLGTFEDHFLS LQRMFNNCEV

VLGNLEITYVQRNYDLSFLKTIQEVAGYVLIALNTVERIPLENLQIIRGN MYYENSYALA

VLSNYDANKTGLKELPMRNLQEILHGAVRFSNNPALCNVESIQWRDIVSS DFLSNMSMDF


each line has 60 characters but the edges are not smooth....any help in this case....


thanks
kumar
Sep 15 '07 #5
Atli
5,058 Expert 4TB
This can be fixed by using the right font. Like Courier New, for example.
Sep 15 '07 #6

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

Similar topics

0
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default...
1
by: Cern | last post by:
Is it somebody out there who has made a migration from an Oracle server to an MySQL server?? The scenario is as simply: I've got a Oracle 8 server with a database with content that I want to...
9
by: elyob | last post by:
Hi, I'm looking at storing snippets of details in MySQL about what credit cards a business excepts. Rather than have a whole column for Visa, another for Amex etc ... I am looking at having a...
3
by: Stephen Preston | last post by:
I can't get an $array to be used as a select query on a mySQL database. I have a 'parts list' which displays on a page (works fine) and is a form. At the end of each row is a input type='text'...
7
by: Daz | last post by:
Hi. I am trying to select data from two separate MySQL tables, where I cannot use join, but when I put the two select queries into a single query, I get an error telling me to check my syntax. Both...
12
by: mantrid | last post by:
Hello Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql...
10
by: Lloyd Harold | last post by:
I'm very new to PHP and attempting to put together a simple script for retrieving MySQL data of personal records. The MySQL table I'm using consists of: 0: id 1: name 2: location (an integer...
21
by: bruno_guedesav | last post by:
I've made a function to fetch all results as an array of result- arrays. Getting the result arrays is easy, via mysql_fetch_array, and function itself is quite simple, as follows: function...
2
by: poreko | last post by:
I am connecting to my database using Object oriented PHP. My query is returning results but at the end of my table,at the bottom of the page I keep having this error when I run my program: Warning:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.