Jump to content

mysql query no error being displayed.


acctman

Recommended Posts

the row's below (i.e $row['m_user'] , etc) re not pulling any data, no errors are being displayed either

 

<?
$userid = '39';

// Get the total referrals
$request = mysql_query("
SELECT SUM(ref_points) AS totalPoints, COUNT(*) AS totalRef
FROM rate_referrals
WHERE ref_userid = $userid
GROUP BY ref_userid") or die(mysql_error());
list ($totalPoints, $totalRef) = mysql_fetch_row($request);
mysql_free_result($request);

$request = mysql_query("
SELECT COUNT(*)
FROM rate_referrals
WHERE ref_userid = $userid
	AND (ref_status = 0 OR ref_status = 1)") or die(mysql_error());
list ($pendingReferrals) = mysql_fetch_row($request);
mysql_free_result($request);


// Get the referal id, referal member, total points and so on.
$request = mysql_query("
SELECT
	mem.m_id, mem.m_date, mem.m_type, mem.m_user, ref.ref_id, ref.ref_mem, ref.ref_userid,
	ref.ref_status
FROM rate_referrals AS ref
	LEFT JOIN rate_members AS mem ON (ref.ref_userid = mem.m_id)
WHERE ref.ref_userid = $userid
	AND ref.ref_status = 2") or die(mysql_error());

echo '
<h1>Total Points ' . $totalPoints . '</h1>
<h1>Total Referrals ' . $totalRef . '</h1>
<h1>Pending Referrals ' . $pendingReferrals . '</h1>
<table>
<tr>
	<td>Name</td>
	<td>Gender</td>
	<td>Date</td>
	<td>Status</td>
<tr>';

while ($row = mysql_fetch_assoc($request))
{
echo '
<tr>
	<td>' . $row['m_user'] . '</td>
	<td>' . ($row['m_type'] == 2 ? 'Male' : 'Female') . '</td>
	<td>' . $row['m_date'] . '</td>
	<td>' . $row['ref_status'] . '</td>
</tr>';
}
mysql_free_result($request);

echo '
</table>';

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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