Search found 45 matches

by gammaman
Sun May 02, 2010 8:19 am
Forum: PHP - Code
Topic: Help with PHP and query
Replies: 1
Views: 98

Help with PHP and query

When I execute the following query and print_r the result, I get a resource #id 4 error if($id == "contract"){ $itemNum = $_POST['itemNo']; foreach($itemNum as $key=>$value) { if (!empty($value)) { $item[] = $value; } } $itemC = count($item); //this has a count of 1 print_r($itemC); // 1 p...
by gammaman
Sat May 01, 2010 3:35 pm
Forum: PHP - Code
Topic: drop down to create drop down.
Replies: 1
Views: 118

drop down to create drop down.

How can I have a drop that list that when a choice is made exectes php server self. Then based on what is posted back, another drop down appears in place of the first. I need to keep the values of both drop downs to send to another page later. See I have this query to select contract #'s. They are p...
by gammaman
Sat May 01, 2010 8:44 am
Forum: PHP - Code
Topic: urgent help with arrays
Replies: 2
Views: 157

Re: urgent help with arrays

Yes this work thanks. One thing though

$tmp = array();
foreach($array as $key=>$value) {
if (!empty($key)) {
$tmp[] = $value;
}


it should be !empty $value;
by gammaman
Sat May 01, 2010 8:15 am
Forum: PHP - Code
Topic: urgent help with arrays
Replies: 2
Views: 157

urgent help with arrays

How can i take the array below and remove the empty values and then reorder the array?

Array ( [0] => 20 [1] => [2] => [3] => [4] => [5] => 40 [6] => [7] => [8] => [9] => )


So this would then become [0]=> 20 , [1] => 40


Thank you in advance.
by gammaman
Sun Apr 25, 2010 12:25 pm
Forum: PHP - Code
Topic: Help with arrays from database result
Replies: 2
Views: 151

Re: Help with arrays from database result

Not really what I mean. I want to store elements 0-5 in second array(). Then comare second array to another array say array3 using array_diff(). Then I want to go back to first array and grab the next 6 elements 6-11 and put those in second array() and again using array3 compare using array_diff().
by gammaman
Sun Apr 25, 2010 7:43 am
Forum: PHP - Code
Topic: Help with arrays from database result
Replies: 2
Views: 151

Help with arrays from database result

I have an array that holds the result from a database select. The array always changes size depending on the number of rows. What I am trying to do is take every sixth index ( [0] - [5], [6] - [11]) etc. And put those in there own array. I then want to use array_diff to compare each of them with ano...
by gammaman
Sat Apr 17, 2010 5:46 pm
Forum: PHP - Code
Topic: confirm button
Replies: 1
Views: 119

confirm button

I have this button that when clicked executes an oracle statement that starts a new data page. How can I have a confirm button in javascript (I know php does not really do confirm buttons) that sends a value to my button to know weather or not to execute the oracle statement. I cannot put the php co...
by gammaman
Mon Apr 12, 2010 6:02 pm
Forum: PHP - Code
Topic: Help updating single value of returned database rows.
Replies: 1
Views: 78

Help updating single value of returned database rows.

Ok I am trying to take a query from my database and take that query and put it into a form so that the user can edit value(s) and then update the database. The problem is that the form has multiple rows and so I need indexes which I am having a hard time getting. Look trough the code to see my code ...
by gammaman
Tue Apr 06, 2010 4:28 pm
Forum: PHP - Code
Topic: insert multiple rows into oracle database.
Replies: 2
Views: 514

insert multiple rows into oracle database.

I need help inserting multiple rows into an Oracle database. I get some errors. I think it is because I need to be using a loop to do the insert but I do not know how. I could also possibly be doing the binding wrong. I start out with a form and then POST to a PHP page and go from there. Here is the...
by gammaman
Mon Feb 15, 2010 8:38 am
Forum: PHP - Code
Topic: submit multiple form values with same name.
Replies: 5
Views: 139

Re: submit multiple form values with same name.

Yeah my bad I meant for not foreach.

Now question is say they only fill out 5 of the ten rows. When I do the insert would it insert blank rows for the other 5 that were left blank? Or would I need some kind of statement to tell it only to insert where $first is not null or not a blank string?
by gammaman
Mon Feb 15, 2010 6:15 am
Forum: PHP - Code
Topic: submit multiple form values with same name.
Replies: 5
Views: 139

Re: submit multiple form values with same name.

So I could have something like this foreach($i=0;$i<=10;$i++) { echo "<tr>"; echo '<input name="first[]" id="first"/>'; } then on some other page where the action takes assuming I have already connected to a database I could do something like this. $first=$_POST['firstn...
by gammaman
Sun Feb 14, 2010 5:27 pm
Forum: PHP - Code
Topic: submit multiple form values with same name.
Replies: 5
Views: 139

submit multiple form values with same name.

Say I have a form with 5 rows each of which contain first and last name. If each of the rows have the same name="" for the fields, how would I submit all of the values. I know that I need to use an array, I just don't know how. Is it name="first"[] or name="first " What...
by gammaman
Tue May 13, 2008 6:32 pm
Forum: PHP - Code
Topic: help with PHP transactions
Replies: 2
Views: 207

help with PHP transactions

My table is not updating why? Here is the create table stuff mysql> create table Bank( -> accID int not null, -> balance float (10,2) not null, -> Primary Key (accID)); Query OK, 0 rows affected (0.06 sec) mysql> Insert into Bank (accID,balance) values (6,1000.00); Query OK, 1 row affected (0.01 sec...
by gammaman
Tue May 06, 2008 9:22 am
Forum: Regex
Topic: help writing an expression
Replies: 1
Views: 798

help writing an expression

I need an expression that does the following

A length of six characters with the first character being a letter. It must contain at least on upper case letter, a number and a symbol (% or # or ~).
by gammaman
Sat May 03, 2008 2:33 pm
Forum: PHP - Code
Topic: help with ltrim and ucfirst
Replies: 1
Views: 138

help with ltrim and ucfirst

lets say I have a statement $var= " name";

How would I combine ltrim and ucfirst togther to get $var="Name";