Accounts

 

{source}

<?php

echo “<strong>Hello $user->name ! <br /></strong>“;

?>
{/source}

 

{source}
<?php
//gets username of logged in user
$user =& JFactory::getUser();
$usernm = $user->username;

//echo “<strong>Hello $user->name !</strong>“;

$con = mysql_connect(“localhost”,”writerfo_powerpu”,”R?Ua$#W!^){0″);
if (!$con)
    {
    die(‘Could not connect: ‘ . mysql_error());
    }

mysql_select_db(“writerfo_powerpublishers”, $con);

$result = mysql_query(“SELECT * FROM jos_vm_order_item”);

$n=0;
$p=0;

echo “<table border=’1′>
<tr>
<th>Sl No.</th>
<th>SKU</th>
<th>Name of Book</th>
<th>Quantity</th>
<th>Price per Book (USD)</th>
<th>Sub Total (USD) </th>
</tr>“;

while($row = mysql_fetch_array($result))

{
//gets username related to Book SKU
switch ($row[‘order_item_sku’])
{
case “B01”:
    $usern=”anindya”;
    break;
case “B02”:
    $usern=”anindya2″;
    break;
case “B03”:
    $usern=”anindya3″;
    break;
case “B011”:
    $usern=”anindya2″;
    break;
default:
    $usern=”adm”;
}

//search if logged in username and username related to Book SKU is same
if (($usern==$usernm) && ($row[‘order_status’]==”C”))

    {
    $n = $n + $row[‘product_quantity’];
    $p = $p + ($row[‘product_quantity’]*$row[‘product_final_price’]);
    echo “<tr>“;
    echo “<td>” . $row[‘order_item_id’] . “</td>“;
    echo “<td>” . $row[‘order_item_sku’] . “</td>“;
    echo “<td>” . $row[‘order_item_name’] . “</td>“;
    echo “<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;” . $row[‘product_quantity’] . “</td>“;
    echo “<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;” . $row[‘product_final_price’] . “</td>“;
    echo “<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;” . $row[‘product_quantity’]*$row[‘product_final_price’] . “</td>“;
    echo “</tr>“;
    }
else
{
}
}

echo “</table>“;

if ($n > 0)
{
echo “<strong><br /><br />Total $n books have been sold.<br />Total Price: USD $p.</strong>“;
}
else
{
echo “<strong><br /><br />Any book (written by you) has not been sold.</strong>“;
}

mysql_close($con);
?>
{/source}

 

 

Power Publishers, Swabhumi Residency, Block 3, Ground floor, P-12 Motijheel Avenue, Kolkata 700074, India

09830089375 / 09051117550

Change Currency
EUREuro