473,387 Members | 1,483 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,387 software developers and data experts.

Need confirmation

Airslash
221 100+
Hello,

I just wish to have confirmation if this snippet of PHP code will actually function properly. It's part of my SqlCommand class, and sort of acts like the SqlCommand in C#.NET.

It should remove a SqlParameter from the Command's internal array of parameters, but I've read somewhere that using a return inside a loop will not always work, so here's the function I wrote.

open for feedback/ suggestions


[PHP]
final public function removeParameter(SqlParameter $parameter) {
for($i = 0; $i < count($this->parameters); $i++) {
if($parameter->equals($this->parameters[$i])) {
unset($this->parameters[$i]);
$this->parameters = array_values($this->parameters);
return;
}
}
throw new InvalidParameterException('Parameter was not found for the Command');
}
[/PHP]
Oct 7 '08 #1
4 1085
Markus
6,050 Expert 4TB
Why don't you test it and tell us if it works?

Makes more sense.
Oct 7 '08 #2
Atli
5,058 Expert 4TB
It should remove a SqlParameter from the Command's internal array of parameters, but I've read somewhere that using a return inside a loop will not always work, so here's the function I wrote.
If the code reaches the return keyword, it will work.
Whether or not it actually reaches the keyword depends on your loop.
Oct 7 '08 #3
Airslash
221 100+
Why don't you test it and tell us if it works?

Makes more sense.
don't have any direct examples to use it in. It's still in development and don't have any running scripts to use it in.

Aptana doesn't give any syntax errors, but don't know if I can trust it.
If I ever get to testing it I'll let you know. Was just hoping if someone tried a similar script and could share his experience with it.
Oct 7 '08 #4
pbmods
5,821 Expert 4TB
Heya, Airslash.

return inside a loop works just fine.

Try running php -l (that's a lowercase 'L') on your script. That will cause PHP to "lint" your file (check for syntax errors; dunno why it's called "linting").
Oct 9 '08 #5

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

Similar topics

1
by: Paky | last post by:
Can someone tell me what command should I use in this PHP file to have the broswer redirected to a "thankyou.htm" page instead of a simple "thanks for your confirmation" message . Thanks in...
3
by: Dennis Allen | last post by:
Hi. On my online ordering form I use browser cookies to keep track of user items. My confirmation page reads: "If any of this information is incorrect, please go back to the order form and...
6
by: Dotnet Guy | last post by:
I want to add a confirmation dialog box before I delete the records in my form. I have a piece of javascript code in html that checks for confirmation. But the main issue lies in calling this...
1
by: Grey | last post by:
I can used the RegisterOnSubmitStatement to set the confirmation alert box, i.e. RegisterOnSubmitStatement("submit", "return confirm('Delete Page?');"). But this confirmation box prompted out from...
0
by: angus | last post by:
Dear all, I would like to implement something like that: when a user submit a request to get an item from the stock...... it will check the stock in the database if the level of that item is...
4
by: DrData | last post by:
I'm working on an ASP.Net application written in C#. On one page, there are several datagrid controls used to display, edit and delete detail records relating to the master record also displayed on...
0
by: Luis Alonso | last post by:
Hi, I had created a web custom control to ask for user' confirmation on deleting and others process. I put the control in a vb file. The control is really simple: only an image button and a hidden...
11
by: Prince of Code | last post by:
Hey There, I have been to this group for a couple of days. I am really impressed by the way people respond. I get answers for all my doubts and that too more info. So I am putting across a doubt...
0
by: bay_dar | last post by:
I have an ASP.NET application with vb that I would like to use a confirmation box with, but only if certain conditions are met. In my case I would only want this msgbox to show up if a user entered...
10
by: shror | last post by:
Hi every body, I need your help in a problem am facing, I have two forms on my website which when submitted they goto single page (confirmation.php) and the two forms are for English and Arabic...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...

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.