need help with echo/print

1Tsme1941

Member
"Why don't you just buy some decent invoicing software, I'm thinking it would make your job a hell
of a lot easier". "But I still suggest you find an actual coding forum to help you."

John, I assumed, from the name Computer Forums that you were an actual coding forum and as a web
developer myself have been using your staff myelf for years. This is an actual property management
system that has been in use for over 10 years. I occasionally update and upgrade using various
forums to help. I've kept coming back here for some time with the same question re. the echo not
working. As many times as John has seen these posts he's not offered the answer. You're right, I
will start using a more knowledgeable forum.
 

Cromewell

Administrator
Staff member
Actually read my posts and look at what you ask for. Instead of displaying "receipt # is 1362" it reads "receipt # is receiptno
everything works perfectly except this doesn't display:
echo "<center>";echo "Receiptno is $receiptno";echo "<br />";
You were asking why the echo wasn't working. Yet it is clearly there at the top of your page.

You can complain about the quality of answers all you want, but I am grasping at straws trying to address a problem that you are not having because it is what you asked about.

If your question is actually why receiptno reads as 'receiptno' not some number as opposed to why the echo doesn't work, your code has the variable set to 'receiptno'.
<?php
$server = "localhost";
$user = "root";
$password = "";
$dbname = "numbersdb";

// Create connection
$connection = mysqli_connect($server, $user, $password, $dbname);
// Check connection
if (!$connection) {
die("Connection failed: " . mysqli_connect_error());
}

SET receiptno = $receiptno + 1 where id=$id";

if (mysqli_query($connection, $sql)) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . mysqli_error($connection);
}


$tenant=$_POST['tenant'];
$amtpaid=$_POST['amtpaid'];
$amtdue=$_POST['amtdue'];
$id="id";
$receiptno='receiptno'; // <--------------------- right here
This is an actual property management
system that has been in use for over 10 years.
o_O
 

1Tsme1941

Member
Cromwell, "You were asking why the echo wasn't working. Yet it is clearly there at the top of
your page."

Are you saying at the top of the receipt or that I'm getting what I erroneously asked for via my code.
Come on Cromewell, If I knew or was finding the answers ?? I'm sure I'm doing something re the echos
but noone will say.

Cromwell, "a problem that you are not having?"

Cromwell, "$receiptno='receiptno'; // <--------------------- right here"

what is wrong with this code?

Cromwell, "If your question is actually why receiptno reads as 'receiptno' not some number"

it is

Cromwell, "as opposed to why the echo doesn't work, your code has the variable set to 'receiptno'."

shouldn't it be?

So that noone might is misled by your post, Cromwell, "1Tsme1941 said: This is an actual property management
system that has been in use for over 10 years."

I developed
this system back about 1910 when I was working in property management.
 

Okedokey

Well-Known Member
Not helpful when you're unclear, unable to use in-forum formatting and we don't have all the information and you've not answered the questions specifically. WHY ARE YOU NOT USING A DEBUGGING TOOL?
 

Okedokey

Well-Known Member
VS Code, CodeRunner, depends on the code. I run VS Studio in Windows with the back end on Linux. Put your code in one of these, they're free, that way you're not needing strangers online to sort basic runtime problems.


1659350158880.png
 
Last edited:

Cromewell

Administrator
Staff member
"$receiptno='receiptno'; // <--------------------- right here"

what is wrong with this code?
If you want it $receiptno to contain 'receiptno' nothing is wrong with it. But if you want it to contain 1362, or whatever was submitted, then everything.
 
Top