benjiej Posted March 9, 2010 Share Posted March 9, 2010 I am a little lost, to be honest I don't even know where to begin on this one. I need to count the lines of that returns on my script. I will attach an example. There is nothing that I can find that leads me in the right direction on this. The last line I show tallies the lines above and then puts them in B RECS. I have everything but the B RECS any help would be greatly appreciated. PID=xxxxxx XXXXXXXX SID=xxxxxx XXXXXXXX START 100129 3.0.0 S0000xxxxxxDEPOSIT1234 AUAX371449635398431 1210000000006989840 1 ABEMPLOYER *SERVICES D US A21 ADP BLVD A3ROSELAND, NJ 07068 B RECS=000000005 Benjie Link to comment Share on other sites More sharing options...
justsomeguy Posted March 9, 2010 Share Posted March 9, 2010 If you're just trying to count how many lines there are, you can use this:$lines = substr_count("\n", $text) + 1;http://www.php.net/manual/en/function.substr-count.php Link to comment Share on other sites More sharing options...
benjiej Posted March 10, 2010 Author Share Posted March 10, 2010 Sorry I didn't clarify I am using DBIsam so php and mysql will not work. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 10, 2010 Share Posted March 10, 2010 That doesn't have anything to do with MySQL, but OK. The common way to count lines is to count the number of newlines. If the only place you're writing code is on the database, and you're not using another scripting language, then you'll need to check the database manual to look for a way to count characters, or count lines, or split a string (e.g. explode), or some way that lets you count these things. In other words, the first step is to figure out what you have available to use. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.