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 3 1267
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($mySpec ialChar,$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
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($myPart s);
echo "</pre>";
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". This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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, which when you click it
bookmarks the site (much easier). The favicon is never saved if the site
is bookmarked this way. Does anyone have any ideas how to fix this??
This is the code:
<script language="JavaScript">
|
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 within the html
file). I'm guessing that there's some syntax or convention I'm not
doing right.
What I most need is an example. Can someone write a js file with an
alert command, for example, to keep it simple. Perhaps something like:
var...
|
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 to us by
a vendor(PCMILER application). The C-Function does the following
operations- Open the server,get distance between two points and close
the server. It takes two input parameters(points).
Whenever I call UDF via select statement it always...
|
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 and
I was wondering if anyone here would be able to give me some tips for
young players such as myself, for learning the language.
Is this the best Newsgroup for support with JAVA?
|
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" src="country_state.js">
</script>
| |
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 those 3 functions in all of my pages?
|
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>
</SCRIPT>
<!-- function declared in the common_js javascript--->
<SCRIPT> mb (this.document ,0 ) </SCRIPT>
|
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 is mainly written in javascript and i need to extract a value from it. i have been using a cookie in the past but i'm having a lot problems with this, so i've decided to extract the value using a hidden form. This is the code that i'm using:
<div...
|
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
php script is being called first it has access to the environment
variables, but the Python script does nt.
How can I forward the variables or call the Python script in such a
way where it can access those variables?
These are the type of...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |