And while you’re at it, print_r($_POST) so that we can actually see what’s IN your $_POST…cause… other than that, the only answer you’re going to be able to receive is “$_POST did not contain those indexes.”
And while you’re at it, print_r($_POST) so that we can actually see what’s IN your $_POST …cause… other than that, the only answer you’re going to be able to receive is “$_POST did not contain those indexes.”
Well, no, you’re not close to finishing it if you’re getting this many undefined variable errors.
print_r, as i advised you to do, prints out an array. For debugging purposes, I told you to print out the $_POST array so that you could see what was missing.
All of the errors seem to be coming from $_POST, so, most likely your errors are in the form you are posting to this script.
I have typically avoided undefined errors two ways depending on what was being done with the variables.
One: define the variable to some “default” - be it zero, an empty string, etc. Then inside the conditional reassign the variables value to something else.
Two: put all of the code that needs the variable inside the conditional.
The problem you are having is because you are assigning a value inside a conditional that may or may not be truthy, resulting in the possibility of the variable not being defined. Then later in the code, outside of the conditional, code wants to use the variable. This may work when the conditional was truthy, but as you can see, if not you will get an undefined error.
I have a suspicion that your problem actually lies deeper than those errors if the $_POST array was empty but… alright. We’ll move on.
$sql = "SELECT name, email,comment FROM blog1"; while($row = $result->fetch_assoc()) { echo '<img src="data:jpeg;base64,'.base64_encode($row['images'])...
You did not select a field named ‘images’ with your query, so $row does not contain a value for that index.
remove the $count = 0; line,
add an elseif that checks if the count is 3;
inside that elseif put the $count = 0;
also inside that elseif echo the shorter HR.
@capljina2 you would make your code so much easier to follow for yourself and others if you only indented it properly.
I have adjusted it this time. In doing so I see there is no space between echo and the following quote mark - whether this makes any difference I don’t know.
you would make your code so much easier to follow for yourself and others if you only indented it properly.
I have adjusted it this time. In doing so I see there is no space between echo and the following quote mark - whether this makes any difference I don’t know.