Jump to content

Fiqhi

Members
  • Posts

    16
  • Joined

  • Last visited

Posts posted by Fiqhi

  1. the current code

    $sqladd=" and b.sh_id='".$cid."'";
    
    $friend=$rwiclas->friends($iduser);
    
    $groups=$rwiclas->groups($iduser);
    
    $companies=$rwiclas->companies($iduser);
    
    $all_id=$iduser;
    
    if($friend!='') $all_id=$all_id.",".$friend;
    
    if($groups!='') $all_id=$all_id.",".$groups;
    
    if($companies!='') $all_id=$all_id.",".$companies;
    
    $sql='select a.id, a.first_name, a.last_name, a.image, b.sh_id, b.uid, b.parent_id, b.sh_det, b.attach_url, b.attach_image, b.attach_title, b.attach_description, b.date, c.ltotal, d.ptotal from share b inner join user a on b.uid=a.id left outer join (select count(sid) as ltotal, sid from share_like group by sid) c on b.sh_id=c.sid left outer join (select count(sh_id) as ptotal, parent_id from share group by parent_id ) d on b.sh_id=d.parent_id  where b.uid in ('.$all_id.') and b.parent_id=0 '.$sqladd.' order by b.date desc';
    

    is only shows result to friend user. The current query is work correctly

    for example user 1 and user 2 = friend / group. user 1 and user 3 = aren't friend

    if user 1 post something. only user 2 can see the post. user 3 cant see it.

     

     

    i want all users sees it

    i think it's the inner join who filtered user 3. if i change it to full join i got syntax error.

  2. $sql='select a.id, a.first_name, a.last_name, a.image, b.sh_id, b.uid, b.parent_id, b.sh_det, b.attach_url, b.attach_image, b.attach_title, b.attach_description, b.date, c.ltotal, d.ptotal from share b inner join user a on b.uid=a.id left outer join (select count(sid) as ltotal, sid from share_like group by sid) c on b.sh_id=c.sid left outer join (select count(sh_id) as ptotal, parent_id from share group by parent_id ) d on b.sh_id=d.parent_id  where b.uid in ('.$all_id.') and b.parent_id=0 '.$sqladd.' order by b.date desc';
    

    this query retrieve information about user from multiple table, but it's excluded user from different group. i want to include all users from different group too. i tried to change left outer join into join but i got syntax error


  3. if ((($_FILES["cmp_image"]["type"] == "image/gif") || ($_FILES["cmp_image"]["type"] == "image/jpeg") || ($_FILES["cmp_image"]["type"] == "image/png") )) {
    if($old_logo!='') unlink('company_image/'.$old_logo);
    $namafile=$_SESSION['uid']."_cp_".$_FILES["cmp_image"]["name"];
    move_uploaded_file($_FILES["cmp_image"]["tmp_name"], "company_image/".$namafile);
    $addfile="cmp_image='".$namafile."',";
    }
    if ($id==''){
    $sql="insert into company set uid='".$iduser."',
    ".$addfile."
    cmp_name='".strip_tags($cmp_name)."',
    cmp_desc='".strip_tags($cmp_desc)."',
    cmp_email='".strip_tags($cmp_email)."',
    cmp_date=now()";
    $msg="<font color=green>Company has been created successfully</font>";
    }else{
    $sql="update company set
    ".$addfile."
    cmp_name='".strip_tags($cmp_name)."',
    cmp_desc='".strip_tags($cmp_desc)."',
    cmp_email='".strip_tags($cmp_email)."'
    where id='".$id."' and uid='".$iduser."'";
    $msg="<font color=green>Company has been edited successfully</font>";
    }
  4. i have input file type button

    <input type="hidden" id="id" name="id" value="'.$id.'" /><input type="hidden" id="old_logo" name="old_logo" value="'.$setuser[cmp_image].'" />
                	<div class="text1">Company Logo:</div>
                    <div class="text2"><input name="cmp_image" id="cmp_image" size="25" type="file" class="btn_style">
    

    This is the upload image function

    if ((($_FILES["cmp_image"]["type"] == "image/gif") || ($_FILES["cmp_image"]["type"] == "image/jpeg") || ($_FILES["cmp_image"]["type"] == "image/png") )) {
    			if($old_logo!='') unlink('company_image/'.$old_logo);
    			$namafile=$_SESSION['uid']."_cp_".$_FILES["cmp_image"]["name"];
    			move_uploaded_file($_FILES["cmp_image"]["tmp_name"], "company_image/".$namafile);
    			$addfile="cmp_image='".$namafile."',";
    		}
    

    And im using this to show the logo

    if ($setuser[cmp_image]!='') {
    	$pictinfo='<img src="company_image/'.$setuser[cmp_image].'" alt="No Photo" height="50" width="100">
    	';
    }else{
    	$pictinfo='<img src="images/icon_no_company.png" alt="No Logo" height="50" width="100">';
    }
    

    The upload button works correctly, but it didn't reflect that the file has been uploaded. $setuser[cmp_image] always return null ($setuser[cmp_image] == ' ')

  5. function checker(file,type) {
    	var mail_tot;
    alert("Step 1"); 
    	$("input[name='mchk[]']:checked").each(function() {
    alert("Step 2"); 
    		var sel_mail=$(this).val();
    		if((mail_tot=='')||(mail_tot=='undefined')){
    			mail_tot = sel_mail;
    		}else{
    			mail_tot = sel_mail+','+mail_tot;
    		}
    	});
    	var a=$.get("invite_stat.php", {
    		mail_tot:mail_tot,type:type},
    		function(data){
    			ShowSearch('',file);
                           
    		}
    	);
    }
    

    When i execute that script popup "Step 1" shows up. but Step 2 didn't

    I need that function to retrieve value of checked checkbox

    <input id="mchk" name="mchk" type="checkbox" value="86">
    <input id="mchk" name="mchk" type="checkbox" value="85">
    
  6. ahh.. i got the real problem...

     

    Thanks to Ch0cu3r

    it's in 

    function checker(file,type) {
    	var mail_tot;
    	$("input[@name='mchk[]']:checked").each(function() {
    		var sel_mail=$(this).val();
    		if((mail_tot=='')||(mail_tot=='undefined')){
    			mail_tot = sel_mail;
    		}else{
    			mail_tot = sel_mail+','+mail_tot;
    		}
    	});
    	var a=$.get("checker_stat.php", {
    		mail_tot:mail_tot,type:type},
    		function(data){
    			ShowSearch('',file);
                           
    		}
    	);
    }
    

    Uncaught Error: Syntax error, unrecognized expression: input[@name='mchk[]']:checked

     

    are my syntax wrong? i need this function to get id of selected checkbox

  7. i dnt get a popup if the function is in the different file from the button.

    if it's in same file, the popup show up

     

    and if im using my own function, both won't work. still not triggered. Maybe because my function call others function in different file too

  8. i've tried to change it into this

    if ($idgroups!='') echo '
    <div class=\'btn_holder\'>
    <a href=\'javascript:procfrom("checker_r.php","a")\'><img src=\'images/accept.png\' alt=\'Accept\' /></a> 
    <a href=\'javascript:procfrom("checker_r.php","d")\'><img src=\'images/decline.png\' alt=\'Decline\' /></a>
    </div>
    <div class=\'next_prev\'><span id=\'naav\>'.$paging->print_link().'</span> <span>'.$data[start].' - '.$data[end].' of Total '.$data[total].' Message</span></div>
    ';
    

    it compiles but still no response when clicking

  9. After deleting "\" i got

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in
    
    

    These buttons are inside single quote

    if ($idgroups!='') echo '
    <div class="btn_holder">
    <a href="javascript:procfrom(\'checker_r.php\',\'a\')"><img src="images/accept.png" alt="Accept" /></a> 
    <a href="javascript:procfrom(\'checker_r.php\',\'d\')"><img src="images/decline.png" alt="Decline" /></a>
    </div>
    <div class="next_prev"><span id="naav">'.$paging->print_link().'</span> <span>'.$data[start].' - '.$data[end].' of Total '.$data[total].' Message</span></div>
    ';
    
  10. im trying to call a function from a button like this

    <a href="javascript:checker(\'checker_r.php\',\'a\')"><img src="images/accept.png" alt="Accept" /></a>

    Calling This Function

    function checker(file,type) {
    	var mail_tot;
    	$("input[@name='mchk[]']:checked").each(function() {
    		var sel_mail=$(this).val();
    		if((mail_tot=='')||(mail_tot=='undefined')){
    			mail_tot = sel_mail;
    		}else{
    			mail_tot = sel_mail+','+mail_tot;
    		}
    	});
    	var a=$.get("checker_stat.php", {
    		mail_tot:mail_tot,type:type},
    		function(data){
    			ShowSearch('',file);
                           
    		}
    	);
    }
    

    If i clicked the button nothing happens. This function will do some task to selected checkbox

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