Narendra Sharma
Narendra Sharma

Reputation: 29

i want to fetch the total user count of given referral ids in table

hi i want to fetch the total user count of given referral ids in table i have tried using left join but i am getting duplicate results from mysql.

i am attaching of screenshot of my table.
when user register we ask the sponser id which is actually the referral id 
of other user.

table containing the referral id and sponser id

Upvotes: 0

Views: 11165

Answers (3)

Barmar
Barmar

Reputation: 782107

Change the JS to:

function post(form)
 { loading(1); 
   $.ajax({ type: 'POST',
            dataType: 'image/jpeg',
            url: 'collage.php',
            data: $('#'+form).serialize(), 
            success: function(data) 
      { $('#image').html('<img src="data:'+base64_encode(data)+'"') }
           });
   return false; }

See This question for information about implementing base64_encode in JS.

Upvotes: 1

iMoses
iMoses

Reputation: 4348

I don't see why you need ajax anyway. collage.php returns a valid image, so you can use the link used for your ajax call as the img tag src url. Just pass any variables you may need through the query string.

Example:

var queryString = $('#' + form).serialize();
$('#image').html('<img src="collage.php?' + queryString  + '"/>');

Upvotes: 3

tinybai
tinybai

Reputation: 916

In php manual, describe the function imagejpeg( resource $image [, string $filename [, int $quality ]] )

imagejpeg() creates a JPEG file from the given image

An image resource, returned by one of the image creation functions, such as

imagecreatetruecolor()

or

resource imagecreatefromjpeg ( string $filename )

then you can use imagejpeg to output an image

Upvotes: 0

Related Questions