Jump to content

TAViX

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by TAViX

  1. That's exactly what I have. So what's the solution? Any workaround of this? On short, how do I upload the same data, on the same rows but on 2 diferent tables? :'(
  2. Ok, I have 2 tables let's say first one is called batch_info with the following entries: batch_id (Primary Key - PK), trainee_num (FK), nickname (FK), etc, and passport_id with those entries: passport_id (PK), trainee_num (PK), nickname (PK), etc... As you can see in the first table, batch_id, trainee_num and nickname, are linked to the values from the second table. Now, I have this script that introduce the values in passport_info table, but the problem is that this script doesn't also update/insert the values from trainee_num and nickname also in the batch_info table, even if the entries are linked... MySQL: batch_info Links to: trainee_num: dbrev00.passport_info.trainee_num ON DELETE: cascade ON UPDATE: cascade trainee_num: dbrev00.passport_info.nickname ON DELETE: cascade ON UPDATE: cascade So my question is, how to update this code in order to have the same values in both tables?? mysql_query("INSERT INTO passport_info (trainee_num, sur_name, given_names, middle_name, nickname) VALUES ('".clean($tc)."', '".clean($sn)."', '".clean($gn)."','".clean($mn)."','".clean($nn)."')" ) or die(mysql_error()); Thanks in advance.
  3. Sorry I'm a little tired... How to extract the data from database for edit in that table, by specifying a value found in one of the cels. In my case the "entry" column. So when I'm typing the value 123, for example, I need that all the values from that row to be displayed for edit. Thank you.
  4. Sorry guys, is the enoying me again. I have a very simple problem this time. But because is so simple I cannot make it work at all:crying: :crying: :crying: Anyways, I have a table in MySQL, with something like this: pr_id | entry | val1 | val2 | val3 | val4 00001 | 123 | bla1 | bla2 | bla2 | 00002 | 310 | 00003 | 234 | 00004 | 323 | ... ...... I created a text box for the entry values, so when I'm choosing a number from entry (ex: 123) all the datas from the 123 row (val1, val2, etc) to be listed for edit into a table. That's it. Here is a sketch: Thank you very much in advance.
  5. Ok guys. I've managed to make the script, but can you help me now a little? I need that after inserting the data in the textboxes, press the PREVIEW button, to list the data inputed, and to have 2 choices, INSERT in the database, and BACK to edit the texboxes again. I have a very hard time also to create the script that uploads all the data, after PREVIEW, in my database. mysql_select_db($database_DB_rev00, $DB_rev00); $query_Batch_in = "SELECT trainee_code, sur_name, given_name, middle_name, nickname FROM passport_info"; $Batch_in = mysql_query($query_Batch_in, $DB_rev00) or die(mysql_error()); $row_Batch_in = mysql_fetch_assoc($Batch_in); $totalRows_Batch_in = mysql_num_rows($Batch_in); mysql_select_db($database_DB_rev00, $DB_rev00); $query_compcode = "SELECT comp_code FROM comp_info"; $compcode = mysql_query($query_compcode, $DB_rev00) or die(mysql_error()); $row_compcode = mysql_fetch_assoc($compcode); $totalRows_compcode = mysql_num_rows($compcode); ?><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Batch Member Input</title> <style type="text/css"> <!-- #title { position:absolute; left:150px; top:82px; width:742px; height:154px; z-index:1; } body { background-repeat: no-repeat; } #apDiv1 { position:absolute; left:150px; top:163px; width:699px; height:272px; z-index:2; } .style5 {font-size: smaller; font-weight: bold; } .style8 {font-weight: bold} #apDiv2 { position:absolute; left:128px; top:182px; width:727px; height:164px; z-index:3; } #apDiv3 { position:absolute; left:149px; top:637px; width:725px; height:631px; z-index:4; } .style10 { font-size: small; font-family: Verdana, Arial, Helvetica, sans-serif; } .style12 {color: #2A0055} #list_tbl1 { position:absolute; left:148px; top:503px; width:726px; height:174px; z-index:4; } #tbl01 { position:absolute; left:147px; top:503px; width:730px; height:508px; z-index:4; } #apDiv4 { position:absolute; left:148px; top:504px; width:744px; height:484px; z-index:4; } .style14 {color: #000000} .style16 {color: #000000; font-weight: bold; } #apDiv5 { position:absolute; left:17px; top:219px; width:105px; height:66px; z-index:5; } #apDiv6 { position:absolute; left:127px; top:442px; width:742px; height:196px; z-index:4; } #apDiv7 { position:absolute; left:102px; top:730px; width:725px; height:191px; z-index:4; } --> </style> </head> <body> <div id="apDiv2"> <p> <style type="text/css"> body{ font-size:10pt; font-family:Arial,Tahoma,Verdana; color:#555; } table{ background:#777; border:1px solid #cfcfcf; } td,th { background:#fff; padding:10px; } td { font-size:10pt; } form ul { list-style-type:none; width:250px; } form ul li { margin-top:1px; padding:10px; height:30px; border:1px solid #999; } strong.err { color:#930; display:block; margin:5px 0px; } #tab2 { margin-bottom:5px; } #tab2 input{ border:0px; background:none; } </style> </p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p> <?php error_reporting(0); $batch = $_POST['batch_nr']; // Get batch textbox $person = $_POST['person_nr']; // Get person textbox ?> </p> <table width="177" border="1" cellpadding="2" cellspacing="1" bordercolor="#2A0000"> <tr> <th width="119" align="left" bordercolor="#6E0067" bgcolor="#2A00AA" scope="row"><span class="style12">バッチ番号</span></th> <td width="41" align="center"><input name="batch_nr" type="text" id="batch_nr" value="<?php echo $batch; ?>" size="2" maxlength="3"></td> </tr> <tr> <th align="left" bordercolor="#6E0067" bgcolor="#2A00AA" scope="row"><span class="style12">バッチ人数</span></th> <td align="center"><input name="person_nr" type="text" id="person_nr" value="<?php echo $person; ?>" size="2" maxlength="3"></td> </tr> </table> <p class="style10">上記の条件でバッチメンバー登録表作成します </p> <p> <input type="submit" name="submit1" value="実行"> </p> </form> </div> <div id="tbl01"> <?php if (isset($_POST['submit1'])) { $person = (int)$person; if($batch==''||$person=='') echo "<strong class='err'>Please ensure that \"Person nr.\" is a number</strong>"; else { ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p class="style10">バッチメンバー登録表 </p> <span class="style10">「名前」、「ニックネーム」、「配属先会社コード」を入力してください</span> <table width="730" height="99" border="1" cellpadding="2" cellspacing="1" bordercolor="#2A0000" id="tab02"> <tr> <th width="100" scope="col"><span class="style14">研修生番号</span></th> <th colspan="3" scope="col"><span class="style14">名前</span></th> <th width="108" scope="col"><span class="style14">ニックネーム</span></th> <th width="158" scope="col"><p class="style14">配属先会社コード</p></th> </tr> <tr> <td align="center"><span class="style16">Trainee code</span></td> <td width="95" align="center"><span class="style16">Sur Name</span></td> <td width="122" align="center"><span class="style16">Given Names</span></td> <td width="102" align="center"><span class="style16">Middle Name</span></td> <td align="center"><span class="style16">Nickname</span></td> <td align="center"><span class="style16">Company Code</span></td> </tr> <?php for($i=1;$i<=$person;$i++) { echo " <tr> <td align='center'><input type='text' name='tc' value='{$batch}00{$i}' size='3' maxlength='3'></td> <td align='center'><input type='text' name='sn' size='7'></td> <td align='center'><input type='text' name='gn' size='7'></td> <td align='center'><input type='text' name='mn' size='7'></td> <td align='center'><input type='text' name='nn' size='7'></td> <td align='center'><input type='text' name='cc' size='4'></td> </tr> "; } echo " </table> <input type='submit' name='submit2' value='Preview'> </form> "; } } if (isset($_POST['submit2'])) { // How to insert all the data from the texboxes in the mysql table??? echo " I need here to list the data before inserting in the MySQL database table <table width='730' height='99' border='1' cellpadding='2' cellspacing='1' bordercolor='#2A0000' id='tab02'> <tr> <th width='100' scope='col'><span class='style14'>研修生番号</span></th> <th colspan='3' scope='col'><span class='style14'>名前</span></th> <th width='108' scope='col'><span class='style14'>ニックネーム</span></th> <th width='158' scope='col'><p class='style14'>配属先会社コード</p></th> </tr> <tr> <td align='center'><span class='style16'>Trainee code</span></td> <td width='95' align='center'><span class='style16'>Sur Name</span></td> <td width='122' align='center'><span class='style16'>Given Names</span></td> <td width='102' align='center'><span class='style16'>Middle Name</span></td> <td align='center'><span class='style16'>Nickname</span></td> <td align='center'><span class='style16'>Company Code</span></td> </tr> </table> "; } ?> </body> </html> Thank you very much in advance.
  6. I'm having a very hard time to create a script that uploads all the data from a table into the database. Now the table can have from 1 to 999 entries, and I only can upload 1 entry. How do I do to upload all of the entryes at once??? Thanks. <?php require_once('../Connections/DB_rev00.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_DB_rev00, $DB_rev00); $query_Batch_in = "SELECT trainee_code, comp_code, sur_name, given_name, middle_name, nickname FROM passport_info"; $Batch_in = mysql_query($query_Batch_in, $DB_rev00) or die(mysql_error()); $row_Batch_in = mysql_fetch_assoc($Batch_in); $totalRows_Batch_in = mysql_num_rows($Batch_in); ?><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Batch Member Input</title> <style type="text/css"> <!-- #title { position:absolute; left:150px; top:82px; width:742px; height:154px; z-index:1; } body { background-repeat: no-repeat; } #apDiv1 { position:absolute; left:150px; top:163px; width:699px; height:272px; z-index:2; } .style5 {font-size: smaller; font-weight: bold; } .style8 {font-weight: bold} #apDiv2 { position:absolute; left:128px; top:182px; width:727px; height:164px; z-index:3; } #apDiv3 { position:absolute; left:149px; top:637px; width:725px; height:631px; z-index:4; } .style10 { font-size: small; font-family: Verdana, Arial, Helvetica, sans-serif; } .style12 {color: #2A0055} #list_tbl1 { position:absolute; left:148px; top:503px; width:726px; height:174px; z-index:4; } #tbl01 { position:absolute; left:147px; top:503px; width:730px; height:508px; z-index:4; } #apDiv4 { position:absolute; left:148px; top:504px; width:744px; height:484px; z-index:4; } .style14 {color: #000000} .style16 {color: #000000; font-weight: bold; } #apDiv5 { position:absolute; left:17px; top:219px; width:105px; height:66px; z-index:5; } #apDiv6 { position:absolute; left:127px; top:442px; width:742px; height:196px; z-index:4; } #apDiv7 { position:absolute; left:102px; top:730px; width:725px; height:191px; z-index:4; } --> </style> </head> <body> <div id="apDiv2"> <p> <style type="text/css"> body{ font-size:10pt; font-family:Arial,Tahoma,Verdana; color:#555; } table{ background:#777; border:1px solid #cfcfcf; } td,th { background:#fff; padding:10px; } td { font-size:10pt; } form ul { list-style-type:none; width:250px; } form ul li { margin-top:1px; padding:10px; height:30px; border:1px solid #999; } strong.err { color:#930; display:block; margin:5px 0px; } #tab2 { margin-bottom:5px; } #tab2 input{ border:0px; background:none; } </style> </p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p> <?php error_reporting(0); $batch = $_POST['batch_nr']; // Get batch textbox $person = $_POST['person_nr']; // Get person textbox ?> </p> <table width="177" border="1" cellpadding="2" cellspacing="1" bordercolor="#2A0000"> <tr> <th width="119" align="left" bordercolor="#6E0067" bgcolor="#2A00AA" scope="row"><span class="style12">バッチ番号</span></th> <td width="41" align="center"><input name="batch_nr" type="text" id="batch_nr" value="<?php echo $batch; ?>" size="2" maxlength="3"></td> </tr> <tr> <th align="left" bordercolor="#6E0067" bgcolor="#2A00AA" scope="row"><span class="style12">バッチ人数</span></th> <td align="center"><input name="person_nr" type="text" id="person_nr" value="<?php echo $person; ?>" size="2" maxlength="3"></td> </tr> </table> <p class="style10">上記の条件でバッチメンバー登録表作成します </p> <p> <input type="submit" name="submit1" value="実行"> </p> </form> </div> <div id="tbl01"> <?php if (isset($_POST['submit1'])) { $person = (int)$person; if($batch==''||$person=='') echo "<strong class='err'>Please ensure that \"Person nr.\" is a number</strong>"; else { ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p class="style10">バッチメンバー登録表 </p> <span class="style10">「名前」、「ニックネーム」、「配属先会社コード」を入力してください</span> <table width="730" height="99" border="1" cellpadding="2" cellspacing="1" bordercolor="#2A0000" id="tab02"> <tr> <th width="100" scope="col"><span class="style14">研修生番号</span></th> <th colspan="3" scope="col"><span class="style14">名前</span></th> <th width="108" scope="col"><span class="style14">ニックネーム</span></th> <th width="158" scope="col"><p class="style14">配属先会社コード</p></th> </tr> <tr> <td align="center"><span class="style16">Trainee code</span></td> <td width="95" align="center"><span class="style16">Sur Name</span></td> <td width="122" align="center"><span class="style16">Given Names</span></td> <td width="102" align="center"><span class="style16">Middle Name</span></td> <td align="center"><span class="style16">Nickname</span></td> <td align="center"><span class="style16">Company Code</span></td> </tr> <?php for($i=1;$i<=$person;$i++) { echo " <tr> <td align='center'><input type='text' name='tc[]' value='{$batch}00{$i}' size='3' maxlength='3'></td> <td align='center'><input type='text' name='sn[]' size='7'></td> <td align='center'><input type='text' name='gn[]' size='7'></td> <td align='center'><input type='text' name='mn[]' size='7'></td> <td align='center'><input type='text' name='nn[]' size='7'></td> <td align='center'><input type='text' name='cc[]' size='4'></td> </tr> "; } echo " </table> <input type='submit' name='submit2' value='Insert'> </form> "; } } if (isset($_POST['submit2'])) { // How to insert all the data from the texboxes in the mysql table??? echo " I need here to upload the data in the MySQL database table "; } ?> </body> </html> <?php mysql_free_result($Batch_in); ?>
  7. Ah, sorry for not being entirely clear. Those numbers I will imput them from the keyboard. Ok. I need to create new entries in database(the tables are like the ones in the registration table from the image). But I need in "trainee code" column to have the code formed by the "batch number" and the next increasing value (for exemple if I need to add 5 more persons, they will be displayed in the "trainee code" column). Anyways the biggest problem is, after I imput those numbers from keyboard, press the CREATE button, to create the extra rows of the table with those values added in the "trainee code" column.
  8. Hello guys. First let me tell you that I'm realy n00b in coding bussiness, my real job involves 3D design not web design, but still I have a very important project and it seems I can only get help by asking YOU people realy nice . :bow: :bow: So my problem is:... First on the page I have 2 text fields, for example, one with a "Batch Nr.", and another with "Person Nr". I also want to have a hidden form with a table that will appear only after I've clicked on the subbmit button (CREATE) in my case. And here is the catch. My table has only 1 row created, that's the title row, BUT the next rows (the number of) are needed to be created by the given value in the "Person Nr." text box. In other words, if I have 5 persons imputed, than the table will need to have extra 5 rows. I have drawn a sketch in paint ( :oops: ) to easily understand what I'm asking...: Then after creatind the rows, I need that the first column to be populated first, with "Batch number", then with a 3 digit nr, from 001 to "Person Nr.", for example 165001. THANK YOU GUYS IN ADVANCE, I kind of known the principle of how to do this, but I need some code, because PHP programing is not my strongest point. Thank you again.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.