www.webdeveloper.com
Results 1 to 3 of 3

Thread: Litle help for peoples with skills! Thx

Hybrid View

  1. #1
    Join Date
    Feb 2014
    Posts
    11

    Litle help for peoples with skills! Thx

    hello i made a litle website where i am selling some staffs , on my website i have SQL databese where that stafs are stored , i made a PHP page where from where peoples can order things that i have for sell problem is in my Database i have a fild that is call Lager i put there how much for exemple books i have at this time ... so man who want to bay hi click on book that hi want and that go to shoping cart but ... when hi enter how much books hi want ... shoping cart make order for that even if i dont have that much right now ! so i need to make a funkcion that will take a look to DB and lager fild.. how muhc books are there and if there is no that much book to not make a order.. now it look like this

    PHP Code:
    else if($_REQUEST['command']=='update'){
            
    $max=count($_SESSION['cart']);
            for(
    $i=0;$i<$max;$i++){
                
    $pid=$_SESSION['cart'][$i]['productid'];
                
    $q=intval($_REQUEST['product'.$pid]);
                if(
    $q>&& $q<=999){
                    
    $_SESSION['cart'][$i]['qty']=$q;
                }
                else{
                    
    $msg='no that much products !, quantity must be a number between 1 and 999';
                }
            }
        } 
    function

    PHP Code:
    function get_lager($pid){
            
    $result=mysql_query("select cena from druckfederi where artnr=$pid") or die("select art from products where artnr=$pid"."<br/><br/>".mysql_error());
            
    $row=mysql_fetch_array($result);
            return 
    $row['cena']; 
    i need to inplement some funkcion like this one .. so it call database for selekted and see what number is in DB if number is lower then number that man order to get him mesage .. that cant be done ...

    Big THANKS for help ! and sorry for my bad ENG

  2. #2
    Join Date
    Feb 2014
    Posts
    11
    i need to replace $q<=999){ ... with some that will call fuction to get information about number of products in DB.. thx

  3. #3
    Join Date
    Feb 2014
    Posts
    11
    Quote Originally Posted by somazvanica View Post
    hello i made a litle website where i am selling some staffs , on my website i have SQL databese where that stafs are stored , i made a PHP page where from where peoples can order things that i have for sell problem is in my Database i have a fild that is call Lager i put there how much for exemple books i have at this time ... so man who want to bay hi click on book that hi want and that go to shoping cart but ... when hi enter how much books hi want ... shoping cart make order for that even if i dont have that much right now ! so i need to make a funkcion that will take a look to DB and lager fild.. how muhc books are there and if there is no that much book to not make a order.. now it look like this

    PHP Code:
    else if($_REQUEST['command']=='update'){
            
    $max=count($_SESSION['cart']);
            for(
    $i=0;$i<$max;$i++){
                
    $pid=$_SESSION['cart'][$i]['productid'];
                
    $q=intval($_REQUEST['product'.$pid]);
                if(
    $q>&& $q<=999){
                    
    $_SESSION['cart'][$i]['qty']=$q;
                }
                else{
                    
    $msg='no that much products !, quantity must be a number between 1 and 999';
                }
            }
        } 
    function

    PHP Code:
    function get_lager($pid){
            
    $result=mysql_query("select cena from druckfederi where artnr=$pid") or die("select art from products where artnr=$pid"."<br/><br/>".mysql_error());
            
    $row=mysql_fetch_array($result);
            return 
    $row['cena']; 
    i need to inplement some funkcion like this one .. so it call database for selekted and see what number is in DB if number is lower then number that man order to get him mesage .. that cant be done ...

    Big THANKS for help ! and sorry for my bad ENG

    there is no one ? that can help here?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles