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

Please help - calling an external script

Hi All,

I have a script which reads a data file, reads the characters one by one and
if a certain character is meet it does something else, at the moment it
echos the fact that it meet a certain character.

I need it to take the characters it has read up to that point and present
them to a database field thats forms part of a set of fields that will be
updated at once. Then it will continue to read the remainder of the file and
repeat the process until it reaches eof.

Is there something similar to goto or gosub, I did some checking and was
laughed at, as you can probably tell I'm a newbie. Maybe I should be calling
an external script? Any assistance is gratefully accepted.

Cheers
Feb 2 '07 #1
3 1245
John Smith wrote:
Hi All,

I have a script which reads a data file, reads the characters one by one
and if a certain character is meet it does something else, at the moment
it echos the fact that it meet a certain character.

I need it to take the characters it has read up to that point and present
them to a database field thats forms part of a set of fields that will be
updated at once. Then it will continue to read the remainder of the file
and repeat the process until it reaches eof.

Is there something similar to goto or gosub, I did some checking and was
laughed at, as you can probably tell I'm a newbie. Maybe I should be
calling an external script? Any assistance is gratefully accepted.

Cheers
Hi John,

Sorry about the laughing, but using goto is not done. It is errorprone and
unneeded since all things can be programmed in another (better/more
structured) way. Goto is send to the Valley Of The Lost Bits a long time
ago. Just don't mention it: Programmers tend to get all freaked up if you
just say 'goto'. ;-)

About your problem:
// define your special character, (just guessing)
$mySpecialChar = "Q";
$myText = "This is a long piece of Q text.Q blaQbla2Qand even more bla."
$myParts = explode($mySpecialChar,$myText);

// now $myParts is an array that contains all pieces that are seperated by
the Q.
// check this:
echo "<pre>";
print_r();
echo "</pre>";

Does that help?

Also: 'Goto' www.php.net, and search for the function explode for details.

Good luck!

Regards,
Erwin Moller
Feb 2 '07 #2
Typo correction:
// now $myParts is an array that contains all pieces that are seperated by
the Q.
// check this:
echo "<pre>";
print_r();

print_r();
Should be
print_r($myParts);
echo "</pre>";

Feb 2 '07 #3
John Smith wrote:
Is there something similar to goto or gosub, I did some checking and was
laughed at, as you can probably tell I'm a newbie. Maybe I should be calling
an external script? Any assistance is gratefully accepted.
John - you're no newbie! Gosub went out in the seventies.

What you want is to write a function, and to call that function.

<?php

function fnHello($x) {
echo "Hello $x.";
}

fnHello("world");
?>

That would output "Hello world".
Feb 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
11
by: Jake j | last post by:
Yes, this is a simple and straightforward thing to do as long as the .js file doesn't use a function. When I try a script with a function in a js file I can't get it to work (though it works fine...
4
by: Sivakumar Shanmugam | last post by:
Group.. We are running on db2 UDF V8 on Sun solaris platform. I created an UDF which calles a C-routine(SQL_API_FN). This C-routine in turn calls an external C-function. The C-function is provided...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
4
by: Adam Smith | last post by:
Hello, How can I call or trigger an external javascript twice in a form? I have <script language="JavaScript" src="country_state.js" name="Country_State"> <script type="text/javascript"...
5
by: Newbie Coder | last post by:
Hello all I have 3 functions in a javacrip file (MyScript.js), which is added to an ASP.NET 2.0 project 1) no right-click 2) no select text (copy...) 3) History.Back()' How do I call...
1
by: msraog | last post by:
Hi, Iam getting an error while calling a function which is declared in the external javascript file jsp file:- ------------------- <SCRIPT language='JavaScript1.1' src='includes/common.js>...
2
by: rickky112 | last post by:
Hi all I'm new to this forum and also new to javascript. I have developed a website using asp pages and i'm using a software package incorporated into the asp pages. The external software...
3
by: Anthony Smith | last post by:
In my php page I am calling a Python cgi. The problem is that originally the Python script was being called directly and it could access the environment variables that were being set. Now since the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.