Jump to content

echo Error, not printing the data i want.


Person

Recommended Posts

<?php
$host = "";
$user = "";
$pass = "";
$dbname = "";

$con = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);

$yesterday = date('20ymd', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y")));
$query= "SELECT SUM(1) AS clicks, SUM(`clcpc`), SUM(`chcpc`) FROM `nuke_pnAffiliate_clicktracking` WHERE `pl` = 'rpu' AND  `date` = '" . $yesterday . "'";

$result= mysql_query($query);
    
$row= mysql_fetch_assoc($result);

echo $result ; 
   
?>

 

should print : 

clicks  SUM(`clcpc`)  SUM(`chcpc`)

211 38.299999821931 84.569998212159

 

but it prints : Resource id #5

 

How do i fix this ?

 

Link to comment
Share on other sites

its only printing clicks.... ?

 

echo $row[clicks].$row[chcpc].$row[clcpc] ;

 

 

Anyone know how it prints it in the Mysql admin ? Thats how i want it to print with the tables, but im new to this and have no idea how to do that...

Link to comment
Share on other sites

Change

<?php
$query= "SELECT SUM(1) AS clicks, SUM(`clcpc`), SUM(`chcpc`) FROM `nuke_pnAffiliate_clicktracking` WHERE `pl` = 'rpu' AND  `date` = '" . $yesterday . "'";

$result= mysql_query($query);
    
$row= mysql_fetch_assoc($result);

echo $result ;
?>

to

<?php
$query= "SELECT SUM(1) AS clicks, SUM(`clcpc`) as clcpc, SUM(`chcpc`) as chcpc FROM `nuke_pnAffiliate_clicktracking` WHERE `pl` = 'rpu' AND  `date` = '" . $yesterday . "'";
$result= mysql_query($query);
$row= mysql_fetch_assoc($result);
printf("%d   %02.12f   %02.12f",$row['clicks'],$row['clcpc'],$row['chcpc']);
?>

 

Ken

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.