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.