I need two different size echo hr

I need two different size echo hr the first time short, second time longer then short then long…Check image up

$sql = "SELECT  name, email,comment FROM blog1";
 $result = $conn->query($sql);
 $count=0;
 $images = array("user1.jpg", "user2.jpg", "user3.jpg"); // 
if ($result->num_rows > 0) {
  // output data of each row
    while($row = $result->fetch_assoc()) {
    $count++;
	if($count==1){
    $count=0;
	 {
    echo '<hr width="100%">'; 
    }
	} else {
    echo '<hr width="180%">';
	
}

that wont work i need help

How can you have a width greater than 100%?

it doesnt matter take size from
http://slimhamdi.net/lina/demos/blog-post-dark.html

Important is every that size will be different one size longer then comment shorter etc like on link

It does matter. You say your code doesn’t work, so clearly there is something wrong with it. The width attribute is deprecated and should be replaced by CSS. I’m also not sure you could use any value other than a pixel value, but a value of over 100% makes no sense in any case.

That site is using border-bottom on the posts, not a <hr>. Why don’t you simply do that?

which border-bottom it has too many

It is in this rule:

.comments-list .comment {
    border-bottom: 1px solid #ddd;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

If you use your browser’s developer tools to inspect the element, you’ll be able to see this for yourself.

i found it but what next

You want to create the same effect that this template has. I’ve shown you how they are doing it. You just add a similar rule to your own CSS, to create the same effect.

 $servername = "localhost";
 $username = "root";
 $password = "";
 $dbname = "blog";

// Create connection
 $conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

 $sql = "SELECT  name, email,comment FROM blog1";
 $result = $conn->query($sql);
 $count=0;
 $images = array("user1.jpg", "user2.jpg", "user3.jpg"); // 
if ($result->num_rows > 0) {
  // output data of each row
    while($row = $result->fetch_assoc()) {
    $count++;
	if($count==1){
    $count=0;
	} 
	 
	 {
    echo '<hr comments-list .comment {
    border-bottom: 1px solid #c74040;
    padding-bottom: 20px;
    margin-bottom: 30px;">'; 
    }


i did that same size coming out

Can I ask how much experience you have with HTML and CSS, because you seem not to have a good grasp of the basics here?

The rule shown is a CSS rule, and as such, belongs in your CSS file. You can’t throw it into an HTML element. You will also need to ensure that your HTML structure is using the same class names, or amend them to match. If you are using the same structure shown in your other topic, the rule will probably work as it stands, but again, without seeing your HTML and the rest of your CSS, I can’t say for certain.

2 Likes

i tried echo '<div class=\".comments-list .comment\"><hr></div>'; same size

Please answer this question, because it will make it so much easier to help you if we know your level of expertise.

You are still trying to put the rule in the PHP. I’ve already explained that it belongs in your stylesheet. As you were advised yesterday, you need to get the HTML and CSS correctly in place before worrying about the PHP.

You are still using php for generating html. It’s obvious you don’t see how the things you try in the php scripts will end up in the generated html page.

I agree whole-heartedly with @Technobear. :slight_smile:

To get a grip of it all and solve your issues, I suggest you do this :

  1. Load the page you are working with in your browser, no matter if it works or not!

  2. Right-click on the page and “Save as…”, choose “Webpage Complete” and save in a new folder on your computer.

  3. In that new folder you will find that page’s php-generated html saved as an html file named after the page’s title, and in additional folders beside the html file, all the external parts like javascript, css and images that the page was using (but no server side scripts!).

  4. Then post the whole html file and all the css file(s) here and we can help you make it work as you wish.

I think that is the best and fastest way, maybe the only workable way, to solve your issues. :slight_smile:

Then, when the page work as you want, and only then!
You can start a new topic in the PHP forum and we will help you make the needed changes in the php scripts so it generates the html that works as you want.

2 Likes

how can i upload folder here together

You can upload it as a .zip folder, although there is a file size limit (and I can’t remember what at present). It’s not an ideal way to get help, as many members will, quite rightly, not wish to download a zip file from an unknown source, but if you’re unable to do it any other way, you’ll just need to take your chance.

N. B. You still haven’t answered my question about your level of experience with HTML/CSS.

click here…

…then follow the instructions. :winky:

coothead

needfix_files.zip (253.8 KB)

HTML/CSS level medium i am good in php and mysql
i want chat privte with admin here i have lot a of websites i mean a lot they have some mistakes which can be fix but will take time.Websites from all kind category

You can send me a PM, if you wish, but please be aware that we do not provide private assistance. One of the benefits of forum posting is that the threads can be of assistance to others with a similar issue, so we always keep the discussion public.

how do it pm

option hide details ?////?