PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
If the goal is just to print ======== between each line, you've got extraneous code. Shorten it to this. I couldn't really see the purpose of $no and $totaldata in the context of what you were trying to accomplish.
JakeJ wrote:If the goal is just to print ======== between each line, you've got extraneous code. Shorten it to this. I couldn't really see the purpose of $no and $totaldata in the context of what you were trying to accomplish.
while ($result=mysql_fetch_array($sql)){
echo $result['name']; <br />
echo "======"
}
based on what he typed to show how he wants it displayed... he doesnt want a "======" below the last element. your code puts it at the bottom of every elemnt. that was the purpose of is if statement, but he didnt execute it very well.
personally, I would think of it a little backwards. rather than put ====== BELOW each element except for the last, I would put it at the top of each one except for the first.
JakeJ wrote:If the goal is just to print ======== between each line, you've got extraneous code. Shorten it to this. I couldn't really see the purpose of $no and $totaldata in the context of what you were trying to accomplish.
while ($result=mysql_fetch_array($sql)){
echo $result['name']; <br />
echo "======"
}
based on what he typed to show how he wants it displayed... he doesnt want a "======" below the last element. your code puts it at the bottom of every elemnt. that was the purpose of is if statement, but he didnt execute it very well.
personally, I would think of it a little backwards. rather than put ====== BELOW each element except for the last, I would put it at the top of each one except for the first.