1.

Solve : need advice re php access?

Answer»

Hi guys, help me with my little coding problem. please.<BR>I key in "localhost/invoice/apdue.php" and get desired
apdue.php results below:
Quote

9/28/13 Accounts payable Report
;
   due    days       
acct#    customer    description    date    late    charges    paid    due
===================================================================
0   Caromont Medical Group.    remove, EAR WAX   2013-02-08   0   259.52   259.52   0.00
0   Homesteaders Life Co.   funeral arrangment   2013-01-13   0   72.99   0.00   72.99
0   OrthoCarolina   shoulder repair   2013-02-08   0   468.47   100.00   368.47
0   Presbyterian Hospital      2013-02-08   0   568.57   100.00   468.47
0   Time Warner Cable   intetrnet service   2013-02-03   0   108.54   108.54   0.00
0   Boost Mobile   phone bill   2013-01-26   0   40.00   0.00   40.00
0   Boost Mobile   phone bill   2013-01-17   0   50.00   0.00   50.00
=====================================================================
Gtotals      1568.09   568.06   999.93


but when trying to open apdue.php via the below (invoicenav.html), that should open
the apdue.php:,

Code: [Select]<html><body bgcolor="#ccffff"><p>
<table bgcolor=pink width="180" border=0>
<tr>
<td><a href="http://localhost/apdue.php">Payables Due</a><br></td>
<tr>
<td><a href="http://localhost/appaid.php">Payables Paid</a><br></td>
<tr>
<td><a href="http://localhost/ardue.php">Receivables Due</a><br></td>
<tr>
 <td><a href="http://localhost/arpaid.php">Receivables paid</a><br></td>
</tr></table>
</center></body</html>
  I get the below:
Quote
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16
 
Below is the aforementioned apdue.php:
[/quote]
Code: [Select]<?php
error_reporting(0);
mysql_connect('localhost','root','');
mysql_select_db('oodb') or DIE("Unable to select database");
$query=" SELECT * FROM oocust WHERE payrec = 'P' && pd = ' '";
$result=mysql_query($query);
$num=mysql_numrows($result);
echo date('m/d/y');
echo "<font size=+2><b> Accounts payable Report</font></b></b><br />";
echo "<table cellspacing=1 cellpadding=1 border=0>
<tr>
<th colspan=3></th>
<th>due</th>
<th>days</th>
<th></th>
<th></th>
<tr>
<th>acct#</th>
<th>customer</th>
<th>description</th>
<th>date</th>
<th>late</th>
<th align=right>charges</th>
<th align=right>paid</th>
<th align=right>due</th>
<tr>
<TH colspan=9>===================================================================</TH>;
</tr>";
while($row = mysql_fetch_array($result))
{
$totcharges = $totcharges + $row['charges'];
$totdue = $totdue + $row['amtdue'];
$totpaid = $totpaid + $row['paidamt'];
echo "<tr>";
echo "<td>" . $row['acctno'] . "</td>";
echo "<td>" . $row['bname'] . "</td>";
echo "<td>" . $row['descr'] . "</td>";
echo "<td>" . $row['duedate'] . "</td>";
echo "<td align=right>" . $row['dayslate'] . "</td>";
echo "<td align=right>" . $row['charges'] . "</td>";
echo "<td align=right>" . $row['paidamt'] . "</td>";
echo "<td align=right>" . $row['amtdue'] . "</td>";
}
echo "<tr>";
echo "<th colspan=9>=====================================================================</TH>";
echo "<tr>";
echo "<td>Gtotals</td>";
echo "<td colspan=4></td>";

echo "<td align=right>" . sprintf("%.2f",$totcharges) .
"</td>";
echo "<td align=right>" . sprintf("%.2f",$totpaid) .
"</td>";
echo "<td align=right>" . sprintf("%.2f",$totdue) .
"</td>";
echo "</tr>";
echo "</table>";
mysql_close();
?>





Pardon my questions.
Have you had much experience running PHP locally?
Why is not the whole thing done in PHP?
Did you already test this code elsewhere?
Do you have other PHP programs that run OK?
Which PHP do you have?


You're going to kick yourself over this!

You said:
Quote
I key in "localhost/invoice/apdue.php"

But the link in 'invoicenav.html' goes to:
Quote
http://localhost/apdue.php

You're missing the '/invoice/' in the link to apdue.php


Discussion

No Comment Found