Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7531163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:06:14+00:00 2026-05-30T05:06:14+00:00

This is what I’m trying to achieve. If All is selected from the drop

  • 0

This is what I’m trying to achieve. If All is selected from the drop down menu then I select all clients from my database. For each client it will then run the script creating the html page and then the pdf. This is where I have got to but I cant get it to generate a html page and pdf for each client.

<?php
$client_id=$_POST["client_id"];
$date_start=$_POST["date_start"];
$date_end=$_POST["date_end"];

if ($client_id == 'ALL') 
{
  $con = mysql_connect("localhost","user","password");
  if (!$con)
  {
    die('Could not connect: ' . mysql_error());
  }

  mysql_select_db("mydatabase", $con);  

  $query = "select client_id from ca_client_account";

  $result = mysql_query($query) or die(mysql_error());

  while($row = mysql_fetch_array($result))
  {
    $command="php $result.php $result $date_start $date_end > $result.html";
    exec($command, $output, $status);
    echo $command;
    if ($status!=0) {print_r($output); die("wget failed with status $status"); }

    $command="wkhtmltopdf-i386 --margin-left 5mm --margin-right 5mm $result.html $result.pdf";
    exec($command, $output, $status);
    if ($status!=0) die("htmltopdf failed");
  }

}
else
{
  $command="php $client.php $client_id $date_start $date_end > $client.html";
  exec($command, $output, $status);
  if ($status!=0) {print_r($output); die("wget failed with status $status"); }

  $command="wkhtmltopdf-i386 --margin-left 5mm --margin-right 5mm $client.html $client.pdf";
  exec($command, $output, $status);
  if ($status!=0) die("htmltopdf failed");
}
?>

For a single client everything is perfect. When I try and generate all client statements I cant get it to work.

What am i doing wrong?

Many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:06:16+00:00Added an answer on May 30, 2026 at 5:06 am

    $result will not deliver what you expect here. You need to specify the exact field you intend to echo out. In this case $row['client_id'] would work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This would list numbers 5.0 to 7.0 in a drop select menu: <%= f.select
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This problem doesn't occur in all projects, hence it makes it even more frustrating.
Basically, what I'm trying to create is a page of div tags, each has
For some reason, after submitting a string like this Jack’s Spindle from a text
This is as close as I've gotten to successfully populating an expandable listview from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This is my database table. Now I want to combine Branch_Id, Acc_no and Acc_Type
This works fine, but I want to make it prettier - and accommodate all
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.