Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Problem in Duplication of data and onenter key
Old 02-10-2011, 01:45 AM Problem in Duplication of data and onenter key
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
Good day!

I have 2 problems with my code 1st is in the last operation name or the 04 Oper it was duplicate but the duplicate was only the operation name and the rest data was blank . I tried to debug it but I ca'n find where is wrong in my syntax. And the 2nd problem is for the enter key function or array, because my textbox I used array, and to move on the next textbox i used enter key, the problem is on the last date when i press enter key instead of move the cursor on the shift textbox it was save. I want to happen is after the last date and I press enter key the cursor was on the shift textbox then after i input data in shift and i press enter key it will save.

Here is my code:

PHP Code:
<?php
 
if($rexist == 0)
                        {
                        
$query "SELECT t.operation_name, t.input_unit, t.output_unit FROM trace_operations t WHERE t.plt_typeno = '" $_POST["plt_typeno"] . "'  AND t.operation_name IN('02 Oper','03 Oper','04 Oper') ORDER BY t.operation_name";
                      
                        
$last_operation_name "";
                        
$result mysql_query($query);
                        if(
$result){
                        
$totalrows mysql_num_rows($result);
                        
$trows $totalrows 1;
                          for(
$ctr 0$ctr $trows$ctr++)
                           {
                          
$row mysql_fetch_array($result);
                          
$tctr $ctr 1;
                           echo 
"\n\t<tr>";
                           echo 
"\n\t\t<td width='800'>";
                           if (
$last_operation_name != $row["operation_name"]) echo $row["operation_name"];
                            
$last_operation_name $row["operation_name"];
                            echo 
"<input type='hidden' width='400' name='opname[]' value='" $row["operation_name"] . "' /></td>";   
                            echo 
"\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" $ctr "' onkeypress='return handleEnter(event,\"timeout" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" $ctr "' onkeypress='return handleEnter(event,\"inqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty" $ctr "' onkeypress='return handleEnter(event,\"outqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td>" $row["input_unit"];
                            echo 
"<input type='hidden' name='iun[]' value='" $row["input_unit"] . "' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='outqty[]' id='outqty" $ctr "' onkeypress='return handleEnter(event,\"idno" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td>" $row["output_unit"];
                            echo 
"<input type='hidden' name='oun[]' value='" $row["output_unit"] . "'></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" $ctr "' onkeypress='return handleEnter(event,\"mcno" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" $ctr "' onkeypress='return handleEnter(event,\"varqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='varqty[]' id='varqty" $ctr "' onkeypress='return handleEnter(event,\"varplt" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='varplt[]' id='varplt" $ctr "' onkeypress='return handleEnter(event,\"dateshift" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" $ctr "' onkeypress='return handleEnter(event,\"shift" $ctr "\");' /></td>";
                           echo 
"\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" $ctr "' onkeypress='return handleEnter(event,\"timein" $tctr "\");' /></td>";
                            echo 
"\n\t</tr>";
                            }
                       if(
$totalrows 1);
                            {
                            
$row mysql_fetch_array($result);
                            echo 
"\n\t<tr>";
                            echo 
"\n\t\t<td width='800'>";
                            if (
$last_operation_name != $row["operation_name"]) echo $row["operation_name"];
                            
$last_operation_name $row["operation_name"];
                            echo 
"<input type='hidden' width='400' name='opname[]' value='" $row["operation_name"] . "' /></td>";   
                            echo 
"<input type='hidden' name='opname[]' value='" $row["operation_name"] . "' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" $ctr "' onkeypress='return handleEnter(event,\"timeout" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" $ctr "' onkeypress='return handleEnter(event,\"inqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty" $ctr "' onkeypress='return handleEnter(event,\"outqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td>" $row["input_unit"];
                            echo 
"<input type='hidden' name='iun[]' value='" $row["input_unit"] . "' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='outqty[]' id='outqty" $ctr "' onkeypress='return handleEnter(event,\"idno" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td>" $row["output_unit"];
                            echo 
"<input type='hidden' name='oun[]' value='" $row["output_unit"] . "'></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" $ctr "' onkeypress='return handleEnter(event,\"mcno" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" $ctr "' onkeypress='return handleEnter(event,\"varqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='varqty[]' id='varqty" $ctr "' onkeypress='return handleEnter(event,\"varplt" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='varplt[]' id='varplt" $ctr "' onkeypress='return handleEnter(event,\"dateshift" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" $ctr "' onkeypress='return handleEnter(event,\"shift\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" $ctr "' onkeypress='return handleEnter(event,\"saveform\");' /></td>";
                            echo 
"\n\t</tr>";
                            }
                        echo 
"</table>";
                        echo 
"<p><input type='submit' value='Save' id='saveform' /></p>";
                        echo 
"<input type='hidden' name='plt_typeno' value='" $_POST["plt_typeno"] . "' />";
                        }  
                        }  
?>
Any help is highly appreciated..
Thank you very much.. Ask me a question if my problem did not clear with you.:confused:

Again, Thank you so much
newphpcoder is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-10-2011, 04:08 AM Re: Problem in Duplication of data and onenter key
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
the code is olny part of my code where i encounter problem and the code that i post is if the plt_no did not exist the form will appear. And the form was appear, the code doing now is the last operation name the 04 Oper was duplicated in the database but only the operation name and the rest data was blank.
The second doing of my code is on the last text box for date after I insert date and I pressed enter key instead of the cursor was go to the shift textbox it goes to the save button so I have no chance to insert data in shift textbox.
On my first problem I tried to debug and i think the problem is from this code:
PHP Code:
$query "SELECT t.operation_name, t.input_unit, t.output_unit FROM trace_operations t WHERE t.plt_typeno = '" $_POST["plt_typeno"] . "'  AND t.operation_name IN('02 Oper','03 Oper','04 Oper') ORDER BY t.operation_name"
                       
                        
$last_operation_name ""
                        
$result mysql_query($query); 
                        if(
$result){ 
                        
$totalrows mysql_num_rows($result); 
                        
$trows $totalrows 1
                          for(
$ctr 0$ctr $trows$ctr++) 
                           { 
                          
$row mysql_fetch_array($result); 
                          
$tctr $ctr 1
I tried to edit it but nothing was change. Honestly, i'm not good in coding specially in condition statement.
On my second problem I have no idea why does after I press enter key the save button was press.
Thank you
newphpcoder is offline
Reply With Quote
View Public Profile
 
Old 02-10-2011, 04:54 PM Re: Problem in Duplication of data and onenter key
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Sorry, I haven't a clue what you're asking! Can you explain clearly, in short simple sentences, what you are trying to achieve and what is actually happening. In other words, state to us what brief you mighht have been given, then the results.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is offline
Reply With Quote
View Public Profile
 
Old 02-13-2011, 07:55 PM Re: Problem in Duplication of data and onenter key
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
Quote:
Originally Posted by PaulW View Post
Sorry, I haven't a clue what you're asking! Can you explain clearly, in short simple sentences, what you are trying to achieve and what is actually happening. In other words, state to us what brief you mighht have been given, then the results.

I trying to achieve first is to prevent the saving duplicate of last operation name in database. Second is on the last date textfield after pressing onenter key I want is the cursor goes to shift text field then after on shift text field and i press enter key it goes to save button.

Now the actual happened is on my first problem the last operation name was save twice in my database but the duplicate is only the operation name, I tried to trace the problem and I think it was problem in my query where I posted the code before, but I'm not too sure if in that query has a problem. Second is after I insert data in my last date textfield and I press enter key it save which is not right because I'm not already inserting data in shift textfield. I want is after the date it goes first to shift textfield before on the save button.
newphpcoder is offline
Reply With Quote
View Public Profile
 
Old 02-14-2011, 03:48 AM Re: Problem in Duplication of data and onenter key
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
Good day!
I attached my wholde code for better understanding in my problem. I tried to resolved my problem by tracing the codes and I trace it but I tried to resolved but nothing has change in my output still the 04 Oper was duplicated.
Here is the code where i think I have problem:
PHP Code:
                   
//If not existing the form will appear to insert data.
                    
if($rexist == 0)
                        {
                        
$query "SELECT t.operation_name, t.input_unit, t.output_unit FROM trace_operations t WHERE t.plt_typeno = '" $_POST["plt_typeno"] . "'  AND t.operation_name IN('02 Oper','03 Oper','04 Oper') ORDER BY t.operation_name";
                      

                        
$last_operation_name "";
                        
$result mysql_query($query);
                        if(
$result){
//in this code I think I have a problem why the last operation name was duplicated, but I have no idea how can i resolved it. I'm not good in analyzing and in the syntax condition code.
//in this code happened is the last operation_name was fetch in this for loop and also in the if condition below so it was duplicated. I want to happened is in the last operation name in false on the if condition so that it could not duplicated.
                       
$totalrows mysql_num_rows($result);
                       
$trows $totalrows 1;
                          for(
$ctr 0$ctr $trows$ctr++)
                           {
                          
$tctr $ctr 1;
                          
$row mysql_fetch_array($result);                          
                           echo 
"\n\t<tr>";
                           echo 
"\n\t\t<td width='800'>";
                           if (
$last_operation_name != $row["operation_name"]) echo $row["operation_name"];
                            
$last_operation_name $row["operation_name"];
                            echo 
"<input type='hidden' width='400' name='opname[]' value='" $row["operation_name"] . "' /></td>";    
                            echo 
"\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" $ctr "' onkeypress='return handleEnter(event,\"timeout" $ctr "\");' /></td>";
                          
                           echo 
"\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" $ctr "' onkeypress='return handleEnter(event,\"inqty" $ctr "\");' /></td>";
                          
                           echo 
"\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty" $ctr "' onkeypress='return handleEnter(event,\"outqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td>" $row["input_unit"];
                            echo 
"<input type='hidden' name='iun[]' value='" $row["input_unit"] . "' /></td>";
                            
                            echo 
"\n\t\t<td><input size='6' type='text' name='outqty[]' id='outqty" $ctr "' onkeypress='return handleEnter(event,\"idno" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td>" $row["output_unit"];
                            echo 
"<input type='hidden' name='oun[]' value='" $row["output_unit"] . "'></td>";
                            
                            echo 
"\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" $ctr "' onkeypress='return handleEnter(event,\"mcno" $ctr "\");' /></td>";
                           
                           echo 
"\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" $ctr "' onkeypress='return handleEnter(event,\"varqty" $ctr "\");' /></td>";
                           
                            echo 
"\n\t\t<td><input size='6' type='text' name='varqty[]' id='varqty" $ctr "' onkeypress='return handleEnter(event,\"varplt" $ctr "\");' /></td>";
                           
                            echo 
"\n\t\t<td><input size='6' type='text' name='varplt[]' id='varplt" $ctr "' onkeypress='return handleEnter(event,\"dateshift" $ctr "\");' /></td>";
                            
                            echo 
"\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" $ctr "' onkeypress='return handleEnter(event,\"shift" $ctr "\");' /></td>";
                            
                           echo 
"\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" $ctr "' onkeypress='return handleEnter(event,\"timein" $tctr "\");' /></td>";
                            echo 
"\n\t</tr>";
                            }
                            
                        }
                       if(
$totalrows 0);
                            {
                            
$row mysql_fetch_array($result);
                            echo 
"\n\t<tr>";
                            echo 
"\n\t\t<td width='800'>";
                            if (
$last_operation_name != $row["operation_name"]) echo $row["operation_name"];
                            
$last_operation_name $row["operation_name"];
                            echo 
"<input type='hidden' width='400' name='opname[]' value='" $row["operation_name"] . "' /></td>";   
                            echo 
"<input type='hidden' name='opname[]' value='" $row["operation_name"] . "' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='timein[]' id='timein" $ctr "' onkeypress='return handleEnter(event,\"timeout" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='timeout[]' id='timeout" $ctr "' onkeypress='return handleEnter(event,\"inqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='inqty[]' id='inqty" $ctr "' onkeypress='return handleEnter(event,\"outqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td>" $row["input_unit"];
                            echo 
"<input type='hidden' name='iun[]' value='" $row["input_unit"] . "' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='outqty[]' id='outqty" $ctr "' onkeypress='return handleEnter(event,\"idno" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td>" $row["output_unit"];
                            echo 
"<input type='hidden' name='oun[]' value='" $row["output_unit"] . "'></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='idno[]' id='idno" $ctr "' onkeypress='return handleEnter(event,\"mcno" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='mcno[]' id='mcno" $ctr "' onkeypress='return handleEnter(event,\"varqty" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='varqty[]' id='varqty" $ctr "' onkeypress='return handleEnter(event,\"varplt" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='varplt[]' id='varplt" $ctr "' onkeypress='return handleEnter(event,\"dateshift" $ctr "\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='dateshift[]' id='dateshift" $ctr "' onkeypress='return handleEnter(event,\"shift\");' /></td>";
                            echo 
"\n\t\t<td><input size='6' type='text' name='shift[]' id='shift" $ctr "' onkeypress='return handleEnter(event,\"saveform\");' /></td>";
                            echo 
"\n\t</tr>";
                            }
                        echo 
"</table>";
                        echo 
"<p><input type='submit' value='Save' id='saveform' /></p>";
                        echo 
"<input type='hidden' name='plt_typeno' value='" $_POST["plt_typeno"] . "' />";
                        }  
                       
                        
                    } 
Attached Files
File Type: txt whole_code.txt (20.1 KB, 18 views)
newphpcoder is offline
Reply With Quote
View Public Profile
 
Old 02-14-2011, 08:12 PM Re: Problem in Duplication of data and onenter key
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
I echo this query
Code:
 $query = "SELECT t.operation_name, t.input_unit, t.output_unit FROM trace_operations t WHERE t.plt_typeno = '" . $_POST["plt_typeno"] . "'  AND t.operation_name IN('02 Oper','03 Oper','04 Oper') ORDER BY t.operation_name";
And the output is:
Resource id #9
What is the meaning of that?
newphpcoder is offline
Reply With Quote
View Public Profile
 
Old 02-21-2011, 06:26 PM Re: Problem in Duplication of data and onenter key
Physicsguy's Avatar
404 - Title not found

Posts: 919
Name: Scott Kaye
Location: Ontario
Trades: 0
How many times has this been posted?

http://www.google.com/search?source=...=Google+Search

208 results!?
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Old 02-21-2011, 11:19 PM Re: Problem in Duplication of data and onenter key
RonnieTheDodger's Avatar
Extreme Talker

Posts: 232
Location: Central USA
Trades: 0
Quote:
Originally Posted by Physicsguy View Post
How many times has this been posted?

http://www.google.com/search?source=...=Google+Search

208 results!?
In all fairness, he only hit up about 12 forums with that question. If you go to page two, you will see that the rest of those 208 results do not belong to him.

Quote:
I echo this query

Code:
 $query = "SELECT t.operation_name, t.input_unit, t.output_unit FROM trace_operations t WHERE t.plt_typeno = '" . $_POST["plt_typeno"] . "'  AND t.operation_name IN('02 Oper','03 Oper','04 Oper') ORDER BY t.operation_name";
And the output is:
Resource id #9
What is the meaning of that?
I am assuming you used $query in a database fetch, which would return an Object. You should use var_dump( $resultset ) from that fetch -- not echo.
__________________
Ronnie T. Dodger

[
Please login or register to view this content. Registration is FREE
] [
Please login or register to view this content. Registration is FREE
]
RonnieTheDodger is offline
Reply With Quote
View Public Profile Visit RonnieTheDodger's homepage!
 
Old 02-22-2011, 02:31 AM Problem in function of enter key
Skilled Talker

Posts: 97
Name: rhoda
Trades: 0
Good day!
I got problem in my function on enter key.. I attached my files and code for better understanding of my problem..
Thank you in advance
Attached Files
File Type: zip files.zip (37.7 KB, 12 views)
newphpcoder is offline
Reply With Quote
View Public Profile
 
Old 02-22-2011, 03:01 AM Re: Problem in function of enter key
RonnieTheDodger's Avatar
Extreme Talker

Posts: 232
Location: Central USA
Trades: 0
Is this the same problem that was being hashed out in another thread here? It appears to be ... so why are you starting another thread?

And you are mass posting these threads across multiple forums as another user here pointed out. What is your game exactly?
__________________
Ronnie T. Dodger

[
Please login or register to view this content. Registration is FREE
] [
Please login or register to view this content. Registration is FREE
]

Last edited by RonnieTheDodger; 02-22-2011 at 03:03 AM..
RonnieTheDodger is offline
Reply With Quote
View Public Profile Visit RonnieTheDodger's homepage!
 
Old 02-22-2011, 03:12 PM Re: Problem in Duplication of data and onenter key
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Both threads merged AND moved to HTML.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Problem in Duplication of data and onenter key
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 4.54706 seconds with 13 queries