Jump to content

prohor

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by prohor

  1. On 6/26/2019 at 12:27 AM, Barand said:

    Thanks a lot.. what I added is

    
    success: function (response) { var html = '<option value="">Select Sub Category</option>'; response.forEach(category => { html += "<option value='" + category.categories_id + "'>"+ category.categories_name +"</option>" $("#productCategories"+row).html(html); }) }

     

     

    On 7/20/2020 at 5:20 AM, requinix said:

    So the result you're trying to get for those 5 rows of data is one row with cust_id=126 inc_due=0? Does the inc_amount matter?

    Do you have a larger example?

     

  2. 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
                });
    

  3. 4 hours ago, requinix said:

    So the result you're trying to get for those 5 rows of data is one row with cust_id=126 inc_due=0? Does the inc_amount matter?

    Do you have a larger example?

    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

  4. 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

  5. 22 hours ago, kicken said:

    You'll have to do some debugging by var_dumping your values at various points and seeing what they are.  Make sure your query is returning the data you think it is.

    You should also probably be zeroing out all your variables before the loop so they start fresh for each customer.  Otherwise your previous customer's data will influence the next customers data.

     

     

    @kicken, Thank you a lot. I will try it.

  6. 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>';
    				}

     

  7. On 6/26/2019 at 2:35 PM, MPM said:

    As Barand suggests it looks like you are trying to get a file from a local system to a database.  If that database is remote you will need to get the file to the server (probably using an HTML form).

    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.

  8. 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.

  9. 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.

  10. I want to change text fields background color only for placeholder text. What will change from "green" to "white" when any text is inserted. I want to keep it different when mouse over it. I wrote a code but text field's background color get's back to geen again after cursor taking away after text insertion. 

     

    I have a input box in html form

    <input type="text" id="Editbox4" style="position:absolute;left:50px;top:458px;width:328px;height:30px;line-height:26px;z-index:4;" name="phone" value="" placeholder="Enter Phone Number" >
    

    and for css properties:

    #Editbox4
    {
    background-color: green;	
    color : yellow;
    }
    #Editbox4:focus
    {
    background-color: #FFFFFF;
    color: #000000;	
    }
    #Editbox4:hover{	
    background-color: white; }
    #Editbox4:hover::-webkit-input-placeholder{color:yello;}
    

    What is wrong, how to fix? Please help.

  11. Jacques1 << thank you very much. it solved my problem! <meta charset="utf-8"> was there but your "mysqli::set_charset()" link solved my problem. I added my code and looks like bellow :happy-04: 
    <?php
    $connect = mysqli_connect("localhost", "root", "", "sumonn");
    // this lines solved my problme, changing latin1 to utf8 after connction (start) 
    if (!mysqli_set_charset($connect, "utf8")) {
        printf("Error loading character set utf8: %s\n", mysqli_error($connect));
        exit();
    } else {
        printf("Current character set: %s\n", mysqli_character_set_name($connect));
    } // this was the last line of my changed code   
    	$sql=("SELECT * FROM `notice` ORDER BY id DESC limit 1" );
    	$result_set=mysqli_query($connect,$sql);
    	while($row=mysqli_fetch_array($result_set))
    	{      
           echo $row['notice'];
    	}
           
        if (!mysqli_set_charset($connect, "utf8")) {
        printf("Error loading character set utf8: %s\n", mysqli_error($connect));
        exit();
    } else {
        printf("Current character set: %s\n", mysqli_character_set_name($connect));
    }    
    	
    ?>
    

    Hope it will help others like mine. 

  12. I want to retrieve unicode based (Bengali language) data from mysql (wamp server 3 is running). I have inserted data using PhpMyAdmin and can read the font. but when I tried to read using php in html it just shows '?????' ! I know it is creating problem with unicode data. any solution?? how I can handle in PHP when I can read data from PhpMyAdmin ?

     

    my code is: for lastest row only

    PHP Code:

     

    <?php

    $connect = mysqli_connect("localhost", "root", "", "sumonn");

    $sql=("SELECT * FROM `notice` ORDER BY id DESC limit 1" );

    $result_set=mysqli_query($connect,$sql);

    while($row=mysqli_fetch_array($result_set))

    {

    echo $row['notice'];

    }

     

    ?>

     

     

    Please help!

     

×
×
  • 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.