Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    W3 Validator errors for my site

    Hi, I'm a junior coder so maybe my questions it will look like a stupid question but I don't get it where is the problem on my site.

    Validation Results - W3C Markup Validator

    ! The last 3 errors are which they interested me:

    Line 159, Column 40: document type does not allow element "div" here; assuming missing "li" start-tag
    Line 165, Column 5: end tag for "li" omitted, but OMITTAG NO was specified
    Line 159, Column 1: start tag was here

    I don't know where is the problem but to me when I check the source code the ul and li tags looks fine. and for the last error the div pagination have a closed tag so I don't get it

    Also maybe this code may help for these errors

    Code:
    <div class="list">
    <h2>Lista de jocuri recomandate - <?php if(empty($_GET) || $_GET['pg'] ==1) { echo 'Pagina 1'; } else { echo 'Pagina ' .$_GET['pg']; } ?></h2>
    <ul>
    <? // PHP Query + Pagination: //
    $sql = "SELECT * FROM `db` ORDER BY `id` DESC"; $listLinksCount = mysql_num_rows(mysql_query($sql)); if($listLinksCount > 0) { $listLinks = mysql_query($sql.$sqlLimit); $nrPagini = ceil($listLinksCount / $perpage); } if($listLinksCount > 0) { while($db = mysql_fetch_array($listLinks)) { ?>
    <li><div style="background:url(images/post.png) no-repeat; height:166px; width:197px; "><a href="/<?=$db['weblink']?>"><img src="/files/<?=$db['img']?>" class="img" width="120" height="100" title="Joaca acum <?=$db['title']?>" alt="<?=$db['title']?>" /><span class="title"><?=$db['title']?></span></a></div></li>
    <? } pagination($nrPagini, $pg, '?pg=%pg'); } else { echo 'Database empty.'; } ?>
    </ul>
    
    </div>
    Where is the problem in my code, how can I fix it? Thanks.

  • #2
    New to the CF scene
    Join Date
    May 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think I'll fix it!

    Here's my new code and I hope it is right.

    <div class="list">
    <h2>Lista de jocuri recomandate - <?php if(empty($_GET) || $_GET['pg'] ==1) { echo 'Pagina 1'; } else { echo 'Pagina ' .$_GET['pg']; } ?></h2>
    <ul>
    <? // PHP Query + Pagination: //
    $sql = "SELECT * FROM `db` ORDER BY `id` DESC"; $listLinksCount = mysql_num_rows(mysql_query($sql)); if($listLinksCount > 0) { $listLinks = mysql_query($sql.$sqlLimit); $nrPagini = ceil($listLinksCount / $perpage); } if($listLinksCount > 0) { while($db = mysql_fetch_array($listLinks)) { ?>
    <li><div style="background:url(images/post.png) no-repeat; height:166px; width:197px; "><a href="/<?=$db['weblink']?>"><img src="/files/<?=$db['img']?>" class="img" width="120" height="100" title="Joaca acum <?=$db['title']?>" alt="<?=$db['title']?>" /><span class="title"><?=$db['title']?></span></a></div></li>
    <? { } ?>
    </ul>
    <? } pagination($nrPagini, $pg, '?pg=%pg'); } else { echo 'Database empty.'; } ?>
    </div>
    So i put the pagination line after the ul tag was close and I close the while statment(see BOLD line) because if I don't close there it still continue to echo(in source code) many ul and li tags not properly. I hope what I change is correct. Now the w3 validator say everything is ok.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •