Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by prohor

  1. I am trying to display a dropdown list based on JSON response object, How I can set it for the following code? in html <select class="form-control" name="productCategories[]" id="productCategories<?php echo $x; ?>" onchange="getProductData(<?php echo $x; ?>)" > </select> in javascript $.ajax({ url: 'php_action/fetchDropdownProductData.php', type: 'post', data: {brandId : brandId}, dataType: 'json', success:function(response) { var html = '<option value="">Select Sub Category</option>'; html += response; $("#productCategories"+row).html(html); } // /success });
  2. Thank you. As you can see in the talbe "cust_id = 126" has paid 101,5000,1000 are the sell payment but the "inctype_id = 11" is the only due payment out of inc_due = "500" + "500" =1000 -> so there should be due_left = 1000-100=900 . This is what I want to calculate and display for each cust_id, if any cust_id does not have dues, it should display due_left = 0
  3. I am trying to implement this for two days now but stuck with logics ! Please help. What I can get the due left of every person easily for the following table [image attached] - table link: https://ibb.co/xC53Cf4 where 1.inc_due is the column to get total due for specific person like cust_id 2. inctype_id =11 is the type of dues paid for specific person (cust_id) 3. echo only due left by cust_id or person id
  4. I have become able to display due data in due column but the same value is showing for each customer - what is the wrong I am doing? Here is the code, please somebody help! while ($row_custact = mysqli_fetch_assoc($query_custact)){ $currentuser = $row_custact['cust_id']; $sql_inccur ="SELECT i.inc_date, t.inctype_type, i.inc_amount, i.inc_text, c.cust_no, c.cust_name, i.inc_receipt From customer AS c LEFT JOIN incomes AS i ON c.cust_id = i.cust_id LEFT JOIN inctype AS t ON i.inctype_id = t.inctype_id WHERE c.cust_id = '$currentuser' ORDER BY inc_date DESC"; $query_inccur = mysqli_query($db_link, $sql_inccur); checkSQL($db_link, $query_inccur); while ($row_inccur = mysqli_fetch_assoc($query_inccur)){ $inc_amount = $row_inccur['inc_amount']; $inc_text = $row_inccur['inc_text']; //Iterate over income types and add matching incomes to $total $total_row = $total_row + $row_inccur['inc_amount']; $total_paid = $total_paid + $total_row; // part for total due finding.. and "inc_text" is due column $total_row_due = $total_row_due + $row_inccur['inc_text']; $total_due = $total_due + $total_row_due; // this part gathers only total due paied for an account if($row_inccur['inctype_type']=='Duepay') { $total_duepay = $total_duepay + $row_inccur['inc_amount']; } $remaining_due = $total_row_due - $total_duepay; //echo $remaining_due; } //echo $currentuser; echo '<tr> <td> <a href="customer.php?cust='.$row_custact['cust_id'].'">'.$row_custact['cust_no'].'</a> </td> <td>'.$row_custact['cust_name'].'</td> <td>'.$row_custact['custsex_name'].'</td> <td> '.$remaining_due. ' // showing due left, here is the problem </td> <td>'.$row_custact['cust_address'].'</td> <td>'.$row_custact['cust_phone'].'</td> <td>'.date("d.m.Y",$row_custact['cust_since']).'</td> </tr>'; }
  5. Thank you @MPM sir, Yes. The image is saved in E drive of my local storage under windows 10 Operating system. and it is well bellow in size of allowed file size. It is only 20KB. How I can set Mysql to upload from local file storage When My server is running under C drive of the same operating system? I also do not know how to find the default folder / directory to keep file and upload. Thank you again sir.
  6. Thank you sir, @Barand, it is a file less than 20KB when Maximum is 1MB set. And what is or how I can find the local directory for WAMP server based Mysql server? " If the secure_file_priv system variable is set to a nonempty directory name, the file to be loaded must be located in that directory. " The image is saved in E drive of my local storage under windows 10 Operating system. Thank you once again sir for spending your valuable time to help me.
  7. Hello sir, I am trying to inset a small image img.png (57.7KB) into mysql database. Table structure is id(int) and image(blob). I directly inserting image can cause problems but I need this for test purpose. I can insert the image using localhost/phpmyadmin but when I try command-line using the following command: insert into image(id,image) values (2,load_file('f:\img.png')); or insert into image(id,image) values (2,load_file('f:\\img.png')); error occurs :- ERROR 1048 (23000): Column ‘image’ cannot be null I am using windws 10 os and WampServer 3.1.7 64 bit. (mysql 5.7.24) Please help.
  8. I am trying to learn php and js. Here I am trying to put a value in php varible from javascript alert message input box but failed. here what I have done so far, // <?PHP and other variable is here.... $number='number'; <script> function number{ if (fail == "") { number = prompt('Please enter Phone Number') if (number == "" || number == null) { alert(' You have not specified the Phone Number. Please try again.'); return false; } else { document.getElementById("number").value; return true; } } else { alert(fail); return false; } } </script> So, actually how I can store the value from js alert to php varible? help me. Thanks for your valuable time and opinion.
  9. I have a webpage with following css properties and html for scrolling text. It is showing properly in desktop view but having problem in mobile view like breaking the full text in two line and 2nd line is partially showing from upper part. I am not finding a way to solve that. please see the image for problem. image link of the problem : https://ibb.co/dj2OvR html code ************************ <div class="NewsFeed" id="NewsScroll"> <div id="text"> <?php $stmt = $DB_con->prepare(" SELECT scrollnotice, id FROM products ORDER BY id DESC LIMIT 0, 1"); $stmt->execute(); if($stmt->rowCount() > 0) { while($row=$stmt->fetch(PDO::FETCH_ASSOC)) { echo $row['scrollnotice']; } } ?> </div> </div> ************************* css code: #NewsScroll{ height: 40px; width: auto; background: rgb(63,76,107); /* Old browsers */ background: -moz-linear-gradient(top, rgba(63,76,107,1) 0%, rgba(63,76,107,1) 100%); /* FF3.6-15 */ background: -webkit-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Chrome10-25,Safari5.1-6 */ background: linear-gradient(to bottom, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3f4c6b', endColorstr='#3f4c6b',GradientType=0 ); /* IE6-9 */ color:red; line-height:30px; overflow:hidden; position:relative; } #text { position:absolute; top:5px; left:0; width:100%; height:30px; font-size:25px; animation-name: slide; animation-duration: 30s; animation-timing-function: linear; animation-iteration-count: infinite; -webkit-animation-name: slide; -webkit-animation-duration: 30s; -webkit-animation-timing-function:linear; -webkit-animation-iteration-count: infinite; }
  10. I am trying to show data using "fetch(PDO::FETCH_desc" for show from descending order but it only works for assoc order like bellow code, how I can show it in descending order? I am new to php and pdo, please help. $stmt = $DB_con->prepare(" SELECT name, id FROM class ORDER BY id DESC LIMIT 1, {$recordsPerPage}"); $stmt->execute(); echo $name; if($stmt->rowCount() > 0) { while($row=$stmt->fetch(PDO::FETCH_ASSOC)) { extract($row); echo $name; } }
  11. Thank you sir, your post helped me a lot. I have now working pagination, but I can not mark the active page with css- I am going through error. I have tried with <?php if($page===$i) {echo ' class="selected"';}?> [/code] with the following code [code] for ($i=1; $i<=$totalPages; $i++) { echo "<span class='navigations_items_span'>"; if($page===$i) {echo 'class="selected"',"<b>Page </b>";}; //echo "<b>Page </b>"; echo "<a href='index3.php?page=".$i."' class='navigation_item selected_navigation_item'>".$i."</a>"; // here I should use class "selected" with above code if($page===$i) {echo 'class="selected"',"<b>Page </b>";};
  12. I wanted to display maximum 12 image in a page and if more is there there will show pages number like page 1, page 2.. I have tried with this code but all images showing in page1 and page2 also showing the same images. How I can limit and show first 12 image in page 1 and next 12 in page 2? Please help with the code I have tried. <?php require_once 'dbconfig.php'; if(isset($_GET['delete_id'])) { // select image from db to delete $stmt_select = $DB_con->prepare('SELECT userPic FROM tbl_users WHERE userID =:uid'); $stmt_select->execute(array(':uid'=>$_GET['delete_id'])); $imgRow=$stmt_select->fetch(PDO::FETCH_ASSOC); unlink("user_images/".$imgRow['userPic']); // it will delete an actual record from db $stmt_delete = $DB_con->prepare('DELETE FROM tbl_users WHERE userID =:uid'); $stmt_delete->bindParam(':uid',$_GET['delete_id']); $stmt_delete->execute(); header("Location: index3.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" /> <title>new</title> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <link href="bootstrap/css/navigation.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="container"> <div class="row"> <?php $stmt = $DB_con->prepare('SELECT userID, userName, userProfession, userPic FROM tbl_users ORDER BY userID DESC'); $stmt->execute(); if($stmt->rowCount() > 0) { while($row=$stmt->fetch(PDO::FETCH_ASSOC)) { extract($row); ?> <div class="col-xs-3"> <!-- imgage info uper header sumon <p class="page-header">//<?php echo $userName." / ".$userProfession; ?></p> --> <img src="user_images/<?php echo $row['userPic']; ?>" class="img-rounded" width="250px" height="250px" /> <p class="page-header" align="left"> <?php echo $userName." / ".$userProfession; ?> <br/> </p> </div> <?php } } else { ?> <div class="col-xs-12"> <div class="alert alert-warning"> <span class="glyphicon glyphicon-info-sign"></span> No Data Found ... </div> </div> <?php } ?> </div> <div class="row"> <hr/> <div class="blog_navigation"> <div style="margin-top:20px;margin-left:180px"> <?php $con = mysqli_connect("localhost","root",""); if (!$con) { die(); } mysqli_select_db($con,"shopiteam"); if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = ($page-1) * 12; $sql = "SELECT * FROM tbl_users where status='process' ORDER BY albumid DESC LIMIT $start_from, 12"; //$rs_result = mysql_query ($sql,$con); $rs_result= mysqli_query($con,$sql); $sql = "SELECT COUNT(userName) FROM tbl_users"; $rs_result = mysqli_query($con,$sql); $row = mysqli_fetch_row($rs_result); $total_records = $row[0]; $total_pages = ceil($total_records / 12); for ($i=1; $i<=$total_pages; $i++) { echo "<span class='navigations_items_span'>"; echo "<b>Page </b>"; echo "<a href='index3.php?page=".$i."' class='navigation_item selected_navigation_item'>".$i."</a>"; echo "</span>"; }; ?> </div> </div> </div> </div> </body> </html>
  • 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.