-
Posts
216 -
Joined
-
Last visited
Everything posted by Yohanne
-
Okay, Thanks JC. but i think when you see my database, you might confuse since it is crowded, i might only me can understand it. but okay i give it to you since i know you are genius and you can understand it well. image below are might different to attachment but u can use it as a sample. pro_request.sql.zip pro_user_employee.sql.zip
-
i think, when i solve above. i get all the solution but not. so please help if ever knows that there is same scenario like below, please share it. and i need sample else tutorials since i have no really idea.
-
Wow.. it works thanks a lot..
-
Thank you, jc and i work as your advice above and it works great. but when i trying to work on in my actual database. the header part going into redundant. why? $x = "SELECT REQUEST.request_id, USER.address FROM pro_user_employee AS USER JOIN pro_request AS REQUEST ON USER.employee_id = REQUEST.employee_id"; $y= mysql_query($x);
-
Hi coders, Need help to display database recods. now i have 2 table like below. and i need to display exactly like below. and i think, i need to featch the country to display and i need it to display by column not row. please help, give me an idea. how it to do. while im solving as will here. please help..
-
Hi Coders, i have 2 tables on this scenario and now i need it to distinct the following below and to get the total of quantity. and that 3 records are came from different Branch which is i need to hide the branch name since this page is for ADMIN. any body help me and share how it to do?
-
Displaying mysql data in dropdown menu with PHP
Yohanne replied to tdavid's topic in PHP Coding Help
http://www.w3schools.com/php/php_ajax_database.asp -
solve: and i just to share to you all my solution. hope it help to others <SCRIPT language=JavaScript> function reload(form) { var val=form.category_name.options[form.category_name.options.selectedIndex].value; self.location='addrequest.php?category_name=' + val ; } function reloadtwo(form) { var val=form.category_name.options[form.category_name.options.selectedIndex].value; var val1=form.supplier_name.options[form.supplier_name.options.selectedIndex].value; self.location='addrequest.php?category_name=' + val + '&supplier_name=' + val1 ; } </script> <?php @$category_name = $_GET['category_name']; @$supplier_name = $_GET['supplier_name']; if(strlen($category_name) > 0 and is_numeric($category_name)) { echo "Query Error"; exit; } elseif(strlen($supplier_name) > 0 and is_numeric($supplier_name)) { echo "Query Error"; exit; } $quer2 = mysql_query("SELECT DISTINCT category_name FROM pro_item"); if(isset($category_name) and strlen($category_name) > 0) { $quer = mysql_query("SELECT DISTINCT supplier_name, category_name FROM pro_item WHERE category_name = '$category_name'"); } $quer3 = mysql_query("SELECT DISTINCT supplier_name, category_name FROM pro_item WHERE category_name = '$category_name'"); if(isset($supplier_name) and strlen($supplier_name) > 0) { $quer33 = mysql_query("SELECT DISTINCT item_name,supplier_name,category_name FROM pro_item WHERE category_name = '$category_name' and supplier_name = '$supplier_name'"); } ?>
-
Hi coders, Do you have any other tutorials? i know i am near to what i want. my problem in here is how to re-reload in supplier dropdown part to get all list under in supplier. please coders help me.
-
Hi coders. i achieve 2 dependent drop-down list in more than 5hours of working, and in my case i need 3 dependent drop-down to achieve completely. i use only one table and no querying happen at all. like image below, i get lost to manage in the last part. please help to do correct my code since i get lost on how to add another dependent dropdown in item name part. this code below is working good in just 2 dependent drop-down <SCRIPT language=JavaScript> function reload(form) { var val=form.category_name.options[form.category_name.options.selectedIndex].value; self.location='addrequest.php?category_name=' + val ; } </script> <?php require "../protected/db/db.php"; $sdb = new db(); @$category_name = $_GET['category_name']; if(strlen($category_name) > 0 and is_numeric($category_name)) { echo "Query Error"; exit; } $quer2 = mysql_query("SELECT DISTINCT category_name FROM pro_item"); if(isset($category_name) and strlen($category_name) > 0) { $quer = mysql_query("SELECT DISTINCT supplier_name, category_name FROM pro_item WHERE category_name = '$category_name'"); $quer3 = mysql_query("SELECT DISTINCT item_name, category_name FROM pro_item WHERE category_name = '$category_name'"); } else { $quer=mysql_query("SELECT DISTINCT item_name, supplier_name, category_name FROM pro_item"); } ?> ***CATEGORY*** <?php echo "<select name='category_name' onchange=\"reload(this.form)\"><option>Select Category</option>"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['category_name']===@$category_name) { echo "<option selected value='$noticia2[category_name]'>$noticia2[category_name]</option>"."<BR>"; } else { echo "<option value='$noticia2[category_name]'>$noticia2[category_name]</option>"; } } echo "</select>"; ?> ***SUPPLIER*** <?php echo "<select name='subcat'> <option value=''>Select Name</option>"; while($noticia = mysql_fetch_array($quer)) { echo "<option value='$noticia[supplier_name]'>$noticia[supplier_name]</option>"; } echo "</select>"; ?> ***ITEM NAME*** <?php echo "<select name='subcat'> <option value=''>Select Name</option>"; while($noticia = mysql_fetch_array($quer3)) { echo "<option value='$noticia[item_name]'>$noticia[item_name]</option>"; echo "</select>"; ?>
-
Hi, i get same issue regarding spl_autoload_regester. it did not load file data. why? class Action { public static function systemtitle($className) { $dataname = "../class/" .$className. ".php"; require $dataname; } public static function dataParameter($classNamee) { $datanamee = "../data/" .$classNamee. ".php"; require $datanamee; } } spl_autoload_register('Action::systemtitle'); $datavaluee = new ClassData(); $datavaluee->classdatas(); spl_autoload_register('Action::dataParameter'); $datavaluee = new parameter(); $datavaluee->parameters();
-
Okay thanks CODERS and everyOne, now i get the logic behind spl_autoload...
-
i get lost the example that you recommend but by the way, could you elaborate more, or give me an example like structure above, in use of spl_autoload_regester.
-
yes i have.
-
any idea how to call autoload class in different folder? ex. below that i have.. auto.php <?php require 'login/index.php'; function __autoload($classname) { $filename = "./../class/". $classname .".php"; include_once($filename); } ?> login/index.php <?php $new_apptitle = new ClassAppTitle(); ?> <html> <head> <title><?php $new_apptitle->get_apptitle(); ?></title> </head> <body> </body> </html> now, how do i re-call the $new_apptitle = new ClassAppTitle(); into different folder? let say like below.. tab/home.php <?php $new_apptitle = new ClassAppTitle(); ?> <html> <head> <title><?php $new_apptitle->get_apptitle(); ?></title> </head> <body> </body> </html>
-
Make sure first, that you are connected to your database. $sql("SELECT * FROM users WHERE UserName = '$UserName' && Password = '$Password'"); $login_query = mysql_query($sql) or die("Query Failed :$sql ".mysql_error()); $rows = mysql_num_rows($login_query); if($rows == 1) { echo 'you got login'; } else { echo 'you got wrong user and password'; }
-
Ok Thanks, but same problem even i put that tag. i get to change something, i put " $new_varname = new ClassVar();" inside the public method "table_pro_user". its works he get the data connection but "get_VarConn" and "get_VarsqlConn" he did not read? why? any idea? function __autoload($classname) { $filename = "./../". $classname .".php"; include_once($filename); } class CheckDetail { public function table_pro_user() { $new_varname = new ClassVar(); $new_varname->set_VarsqlConn("SELECT * FROM user WHERE (x = 'a') && (z = 'a')"); $new_varname->get_VarConn = mysql_query($new_varname->get_VarsqlConn()); if(mysql_num_rows($new_varname->get_VarConn) == 1) { echo 'wow'; } else { echo 'ngik'; } } } $dfdf = new CheckDetail(); $dfdf->table_pro_user();
-
Okay Thanks, but there is any other possible way to use class below, inside the class of "CheckDetail"? $new_varname = new ClassVar();
-
Hi coders, i have 2 files where one file is auto loaded into another one file. now i get lost since before i can do this like below but i dont know why i get this error now Undefined variable: new_varname in please help ClassVar.php class ClassVar { function __construct() { $newConnect = new connection(); } public $VarConn; public $VarmysqlCon; public function set_VarConn($VarConn) { $this->VarConn = $VarConn; } function get_VarConn() { return $this->VarConn; } public function set_VarsqlConn($VarmysqlCon) { $this->VarmysqlCon = $VarmysqlCon; } function get_VarsqlConn() { return $this->VarmysqlCon; } } function __autoload($classname) { $filename = "./../". $classname .".php"; include_once($filename); } class CheckDetail { function __construct() { $new_varname = new ClassVar(); } public function table_pro_user() { $new_varname->set_VarsqlConn("SELECT * FROM user WHERE (x = 'a') && (z = 'a')"); $new_varname->get_VarConn = mysql_query($new_varname->get_VarsqlConn()); if(mysql_num_rows($new_varname->get_VarConn) == 1) { echo 'wow'; } else { echo 'ngik'; } } } $dfdf = new CheckDetail(); $dfdf->table_pro_user();
-
Need help in saving data from textboxes inside foreach loop
Yohanne replied to newphpcoder's topic in PHP Coding Help
check your loop. and try to get out the "$reject_type" in the loop under "$compound_type". for($compound_type) { if(..) { true; } else { false; } } for($reject_typ) { if(..) { true; } else { false; } } -
Submit form to same page and then update - not working
Yohanne replied to jarv's topic in PHP Coding Help
if(isset($_POST['submit']) && 'submit' === $_POST['submit']) { echo 'hello'; .............. .............. .............. } else { echo 'hi' } try sample one, above.. if the output is "hi". your post is working else your code inside the open parenthesis are wrong.. -
Hi coders, how to create function that the value is empty or null.? someting like below. function act(empty) { return true; }