Jump to content


Member Since 20 May 2008
Offline Last Active Oct 05 2015 09:35 AM

Topics I've Started

sending mails to different users with different values from database

29 September 2015 - 07:07 AM

Hi all.


How can i send mail to multiple users at the same time with each user getting their own related data.

I'm using php mailer as an engine to send the mail.

Based on this, i'd have loved to setup a cron for it but i do not know how, so i figure i'd just do it manually before i get to know how to setup a cron job.


It's just to send a reminder to users and each user has a different subscription expiry time. I want each user to get their respective expiration date, expiry day etc.




$sql = "SELECT * FROM users WHERE status = '$status'";
$stmt = $pdo->query($sql);

while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
$name = $row['name'];
$acct_no = $row['acct_no'];
$email_addresses = $row['email'];  
$expiry_date = $row['expiry_date'];
$expiry_day = $row['expiry_day'];

$message="Hello $name,<br>
This is to remind you that your subscription will expire in $expiry_day.
Details as follows:
Name: $name<br>
Account Number: $acct_no<br>
Email: $email_addresses<br>
Expire in days: $expiry_day<br>
Expiry Date: $expiry_date
Thank you
$mail = new PHPMailer;

//$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'mail.server.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'mails@services.cap';                 // SMTP username
$mail->Password = 'password';                           // SMTP password
$mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465;                                    // TCP port to connect to

$mail->From = mails@services.cap';
$mail->FromName = 'Club 404';
$mail->addAddress($email_addresses);     // Add a recipient

$mail->WordWrap = 587;                                 // Set word wrap to 50 characters

$mail->AddEmbeddedImage("../img/logo.png", "my_logo");
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Body    = $mess;

Can't access account again

21 September 2015 - 09:06 AM

Hello admin,


I dunno why i cannot login into my account. This is the 3rd time it's happening and even when i reset password, i dont get a mail from phpfreaks.

Pls help restore my account back and why does it keep happening?





why don't i get mail from phpfreaks?



Delete selected and insert into database

21 September 2015 - 09:01 AM

Hi all.


I'm having an issue with my code. I dunno why it's not working as intended.

I want to delete selected rows and insert them into another table just in case i want to recall them. So far the delete is working but i'm having two issues with it.


1. when i select 5 rows and press delete, it echos result for the 5 rows instead of just one echo result.

2. I cannot insert it into another table.




here's my code



$stmt = $pdo->prepare(
"SELECT * FROM $tbl_name
ORDER BY trans_date DESC"

 <form action="" method="post">  
<table class='table-responsive table-condensed table-striped'>

<td align="center" bgcolor="#444444"><font color='#fff'><strong>#</strong></font></td>
<td align='center' bgcolor="#444444"><font color='#fff'>Client Username</font></td>
<td align='center' bgcolor="#444444"><font color='#fff'>Loan Number</font></td>
<td align='center' bgcolor="#444444"><font color='#fff'>Amount</font></td>
<td align="center" bgcolor="#444444"><font color='#fff'><strong>Repayment Amount</strong></font></td>
<td align="center" bgcolor="#444444"><font color='#fff'><strong>Loan Date</strong></font></td>
<td align="center" bgcolor="#444444"><font color='#fff'><strong>Due Date</strong></font></td>
<td align="center" bgcolor="#444444"><font color='#fff'><strong>BTN</strong></font></td>
<td align="center" bgcolor="#444444"><font color='#fff'><strong>FIN</strong></font></td>
<td align="center" bgcolor="#444444"><font color='#fff'><strong>Bank Acct Number</strong></font></td>
<td align="center" bgcolor="#444444"><font color='#fff'><strong>Date Closed</strong></font></td>
<td align="center" bgcolor="#444444"><font color='#fff'><strong>Closed From</strong></font></td>

// keeps getting the next row until there are no more to get
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {

<td align="center"><input name="check_list[]" type="checkbox" value="<?php echo $row['id']; ?>" ></td>
<td><?php     echo $row['email']; ?></td>
<td><?php     echo $row['loan_number']; ?></td>
<td><?php     echo number_format($row['amount_borrow'],2); ?></td>
<td><?php     echo number_format($row['payback_amount'],2); ?></td>
<td><?php    echo $row['trans_date']; ?></td>
<td><?php    echo $row['payback_date']; ?></td>
<td><?php    echo $row['branch_transit_number']; ?></td>
<td><?php    echo $row['financial_institution_number']; ?></td>
<td><?php    echo $row['bank_account_number']; ?></td>
<td><?php    echo $row['date_closed']; ?></td>
<td><?php    echo $row['closed_from']; ?></td>
<input name="delete" type="submit" class="btn btn-default btn-delete" id="delete" value="DELETE SELECTED">


$table=$pdo->query("ALTER TABLE cash_user_transaction AUTO_INCREMENT = 1");

        foreach($_POST['check_list'] as $selected){

$stmt = $pdo->prepare("SELECT * FROM $tbl_name WHERE id = '$selected'");
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {    
$email = $row['email'];
$loan_number = $row['loan_humber'];
$amount_borrow = $row['amount_borrow'];

$stmt = $pdo->prepare("INSERT INTO cash_user_deleted_transaction
        (email, loan_number, amount_borrow, terms_agreement, terms_agreement_days, cost_borrow, trans_date, payback_date, payback_amount, branch_transit_number, financial_institution_number, bank_account_number, status, initial, pay_frequency, refinance_request, date_closed, disbursed_status, date_disbursed, closed_from, date_deleted)
        VALUES(:email, :loan_number, :amount_borrow, :terms_agreement, :terms_agreement_days, :cost_borrow, :trans_date, :payback_date, :payback_amount, :branch_transit_number, :financial_institution_number, :bank_account_number, :status, :initial, :pay_frequency, :refinance_request, :date_closed, :disbursed_status, :date_disbursed, :closed_from, NOW())");

$stmt = $pdo->prepare("DELETE FROM $tbl_name WHERE id=:id");
$stmt->bindValue(':id', $selected, PDO::PARAM_STR);
    echo "<div class='bg-success alert alert-success text-center'>RECORD DELETED</div>";
    echo "<div class='bg-warning alert alert-warning text-center'>RECORD NOT DELETED</div>";
    echo $pay_frequency;
    echo "<br>";
    echo $status;
    echo "<br>";
    echo $amount_borrow;



links wont work on laravel

06 September 2015 - 08:36 AM

Hi all.


No matter what i tried my links just wont work on my laravel app.  My css folder is in the public folder. public/css. I dunno what is wrong. I installed laravel with composer and i am running windows 7 and wamp.

this is the link i used:


<link rel="stylesheet" href="{!! asset('css/bootstrap.min.css') !!}">
<link rel="stylesheet" href="{!! asset('css/styles.css') !!}">



random value change on next page

23 July 2015 - 04:06 AM

Hi all.

I generated a random number and assigned it a variable to be used through out the session but on getting to the next page, the value changes. It is regenerating another number which isnt the intention. I have tried severally but no way!

i really cannot figure out why the value changes in my second page.

$loan =  mt_rand(1000, 9999);
$name = "John";
$_SESSION['num'] = $number;
$sql = ("INSERT INTO table (name, token_number) VALUES(:name, :token_number)
header("location: nextpage.php");
echo "Something went wrong";