0

嗨,我想获取表中给定推荐 id 的总用户数,我尝试过使用左连接,但我从 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.

包含推荐 ID 和赞助商 ID 的表

4

3 回答 3

3

我不明白你为什么需要ajax。collage.php返回有效图像,因此您可以使用用于 ajax 调用的链接作为img标签srcURL。只需通过查询字符串传递您可能需要的任何变量。

例子:

var queryString = $('#' + form).serialize();
$('#image').html('<img src="collage.php?' + queryString  + '"/>');
于 2012-11-07T08:23:53.887 回答
1

将 JS 更改为:

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; }

有关在 JS 中实现的信息,请参阅此问题。base64_encode

于 2012-11-07T08:17:31.880 回答
0

在php手册中,描述函数imagejpeg(resource $image [, string $filename [, int $quality ]])

imagejpeg() creates a JPEG file from the given image

图像资源,由图像创建函数之一返回,例如

imagecreatetruecolor()

或者

resource imagecreatefromjpeg ( string $filename )

然后您可以使用 imagejpeg 输出图像

于 2012-11-07T08:16:35.533 回答