-
Posts
216 -
Joined
-
Last visited
Everything posted by Yohanne
-
Okay, sorry.. and here is. i have a select box to identify input type. under selection there are 1,2 and 3 values that there are different function, that i need to show upon selecting. the code avobe is not working, i mean is, when i selecting each value in option box, there is nothing happen. i want to show value "wwwwwwwww", after selecting value 3.
-
Hi What is the wrong with this code? !DOCTYPE html> <head> <script type="text/javascript"> $('#mylist').change(function(){ if( $(this).val() == '3'){ $('body').append('<input id="myInput" type="text" value = "wwwwwwwww"/>'); }else{ $('#myInput').remove(); } }); </script> </head> <body> <select id="mylist"> <option selected></option> <option value="1" >aaaa</option> <option value="2">bbb</option> <option value="3">ccc</option> </select> </body> </html>
-
Hi, i found source live check and i get hard to apply it in my work since i use multiple input text. i can add input text as many as i can and i can remove it as i can now i can't able use live check into other input text and does anyone can help. and i have no idea how to apply<span id="user-result"></span> into added input text. please help <script type="text/javascript"> // -------------------------------------------- function live check ------------------------ $(document).ready(function() { $("#code").keyup(function (e) { $(this).val($(this).val().replace(/\s/g, '')); var code = $(this).val(); if(code.length < 4){$("#user-result").html('');return;} if(code.length >= 4) { $("#user-result").html('<img src="images/ajax-loader.gif" />'); $.post('check_input.php', {'code':code}, function(data) { $("#user-result").html(data); }); } }); }); // ------------------------------------- function to add input_text ------------------------------ $(function() { var addDiv = $('#div_add'); var i = $('#div_add p').size() + 1; $('#addInput').live('click', function() { $('<p><input type = "text" id="code" required = "required" size="40" name="code[]' + i +'" value=""/><a href="#" id="remNew"><img src = "images/del.png"></a><span id="user-result"></span></p>').appendTo(addDiv); i++; return false; }); $('#remNew').live('click', function() { if( i > 1 ) { $(this).parents('p').remove(); i--; } return false; }); }); </script> <label for="regularInput">Transaction number</label> <div id = "div_add"> <input type="text" id="code" name = "code[]" value = ""required = "required"><h3><a id = "addInput" href = "#"> <span id="user-result"></span><img src = "images/1398145891_square-add.png"></a></h3> </div>
-
Thanks JACQUEST and okay let say ignore the ignore $a_query = mysql_query("INSERT INTO code_number(a,b,c) VALUES('$a[$i]','$b[$i]','$c')")or die(mysql_error());
-
yes exactly JACQUES1 and if i normalize it again its a big re-work since its almost done. before i use the following without for loop and it work well.. and since im going for upgrade, i use for loop to makes users work faster. and sad to say code below is not working. and i use ignore so that i want user to continue and continue to save. for($i = 0; $i<count($a) || $i<count($b); $i++) { $sql = mysql_query("SELECT id from code_number WHERE (a = '$a[$i]') || (b = '$b[$i]') || (a = '$b[$i]') || (b = '$a[$i]')"); $row_count = mysql_num_rows($sql); } if($row_count === 0) { for($i = 0; $i<count($a) || $i<count($b); $i++) { $a_query = mysql_query("INSERT IGNORE INTO code_number(a,b,c) VALUES('$a[$i]','$b[$i]','$c')")or die(mysql_error()); } return $a_query; } else { return false; }
-
yes exactly. and if i normalize it again its a big re-work since its almost done. before i use for($i = 0; $i<count($a) || $i<count($b); $i++) { $sql = mysql_query("SELECT id from code_number WHERE (a = '$a[$i]') || (b = '$b[$i]') || (a = '$b[$i]') || (b = '$a[$i]')"); $row_count = mysql_num_rows($sql); } if($row_count === 0) { for($i = 0; $i<count($a) || $i<count($b); $i++) { $a_query = mysql_query("INSERT IGNORE INTO code_number(a,b,c) VALUES('$a[$i]','$b[$i]','$c')")or die(mysql_error()); } return $a_query; } else { return false; }
-
Hi coders, i have two fields that sometimes user inputed same value from different field and now i dont want to duplicate it even they are different field. and what is the best way to avoid duplicate. $a and $b? for($i = 0; $i<count($a) || $i<count($b); $i++) { $a_query = mysql_query("INSERT IGNORE INTO code_number(a,b,c) VALUES('$a[$i]','$b[$i]','$c')")or die(mysql_error()); } return $a_query;
-
Hi i have this localhost/codeigniter/admin and i get this messege: Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php i just simply copy the index folder in codeigniter and paste it into folder admin that i created and i try to run but i gut messege above. please any one can share how to create admin page?
-
correct syntax for for loop count two variable?
Yohanne replied to Yohanne's topic in PHP Coding Help
Thanks, and woww it works.. -
Hi coders, how to correct syntax with two variable name in just one for loop count? for($i = 0;$i<count($q,$x); $i++ )
-
problem solve using for loop
-
Hi coders, Any help..
-
Hi barand.. really wow and it work great and i know im very close by. and if you observe my posted above, i have 3 tables to join and now i have no idea if i need to create another query to get the result from 3 table and to pass it by to your $query you create? and i need the result from.. ('SELECT code_tss.tss_id, code_tss.branch_id, code_tss.tss_date, code_tss.tss_trans_num, branch.branch_id, branch.brach_name, branch.regions, employees.empid, employees.fname FROM code_tss INNER JOIN branch ON code_tss.branch_id = branch.branch_id INNER JOIN employees ON code_tss.empid = employees.empid WHERE tss_date = "April 5, 2014" ORDER BY regions,brach_name') result +++++++ regions ++++++ brach_name +++++++ tss_trans_num +++++++ fname ++++++++
-
the problem is, i don't get the correct query to distinct of the said column. i need sample mysql code base on image above. please this code is badly not work.. ("SELECT DISTINCT region FROM branch ('SELECT semployees.empid,employees.username,employees.fname,branch.branch_id,branch.brach_name,branch.regions,code_tss.tss_id,code_tss.empid,code_tss.tss_trans_num,code_tss.branch_id,code_tss.tss_date FROM code_tss INNER JOIN branch ON code_tss.branch_id = branch.branch_id INNER JOIN employees ON code_tss.empid = employees.empid ORDER BY `tss_id` DESC LIMIT $vpb_start_page, $vpb_page_limit')")
-
Hi im going to create a report and i have multiple rows of data and im going to distinct some part of my column and in my html table im going call colspan to display correctly. image below is the example should i want to display in my report. please help i need mysql way solutions and sample would be great. Thanks..
-
thanks.. and now i change the scenario and im going explore something and it is not working well and please please let help me to correct this line of codes and i know it is possible. BRANCH : <input type = "text" name = "branch[]" value = ""> DATE : <input type = "text" name = "tssdate[]" value = ""> TSS NUMBER : <input type = "text" name = "tss[]" value = ""> USER : <input type = "text" name = "username[]" value = ""> public function model_newtss($branch,$tssdate,$tss,$username) { if($this->model_newtss) { foreach($this->model_newtss as $tss_s) { $tsss[] = $tss_s; } } $_implode = "('".implode("'),('",$tsss)."')"; $insert_tss = mysql_query("INSERT INTO code_tss(branch_id,tss_date,tss_trans_num,empid) VALUES ".$_implode.""); return $insert_tss; }
-
In image above "BRANCH" and "DATE" is not an array while "TSS #" is an array. BRANCH : <input type = "text" name = "branch" value = ""> DATE : <input type = "text" name = "date" value = ""> TSS NUMBER : <input type = "text" name = "tss[]" value = ""> //this line is, its up to a user how many input he/she want to add and defending on tss number. and now i am getting difficulties, how to insert together array/implode and none array or base on image above.
-
Hi coders, getting hard to insert, according to the image below. public function model_newtss($branch,$tssdate,$tss) { if($tss) { foreach($tss as $tss_s) { $tsss[] = $tss_s; } } $_implode = "('".implode("'),('",$tsss)."')"; $insert_tss = mysql_query("INSERT INTO code_tss(branch_id,tss_date,tss_trans_num) VALUES '$branch','$tssdate','$_implode'"); return $insert_tss; }
-
Need a bit of help with getting data from multiple mysql tables
Yohanne replied to man5's topic in PHP Coding Help
SELECT users.id, user.username, posts.post_id, posts.user_id, posts.title, posts.post, favorites.favorite_id, favorites.user_id, favorites.post_id FROM users INNER JOIN posts ON users.id = posts.user_id INNER JOIN favorites ON posts.post_id = favorites.post_id ORDER BY date limit 4 -
Populate html table based on selected dropdown value
Yohanne replied to afdoal's topic in PHP Coding Help
im just saying you a bit idea.. -
Populate html table based on selected dropdown value
Yohanne replied to afdoal's topic in PHP Coding Help
think about search. "select id from table where Kecamatan = 'selected'"; -
Dynamically create input fields and insert after submit
Yohanne replied to Yohanne's topic in PHP Coding Help
okay,, thanks but may i see your solution? -
Hi coders, i create Dynamically input fields, kindly assist, what going wrong with this.. the problem is cannot save. please.. <html> <head> <title> Dynamically create input fields </title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript"> $(function() { var addDiv = $('#addinput'); var i = $('#addinput p').size() + 1; $('#addNew').live('click', function() { $('<p><input type="text" id="p_new" size="20" name="p_new_' + i +'" value="" placeholder="I am New" /><a href="#" id="remNew">Remove</a> </p>').appendTo(addDiv); i++; return false; }); $('#remNew').live('click', function() { if( i > 2 ) { $(this).parents('p').remove(); i--; } return false; }); }); </script> </head> <body> <div id="addinput"> <?php require_once 'database/connection.php'; $DBcon = new connection(); ?> <p> <form name ="form" action = "" method = "POST"> <input type="text" id="p_new" size="20" name="p_dnew" value="" placeholder="Input Value" /><a href="#" id="addNew">Add</a> <input type="submit" size="20" name="Save" value="Save"/> </form> </p> <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { $p_dnew = implode(',',($_POST['p_dnew']); $query = ("INSERT INTO branch(brach_name) VALUES('{$p_dnew}')"); $result = mysql_query($query); } else { return false; } ?> </div> </body> </html>