Results 1 to 6 of 6

Thread: My CSS Won't Work On This Page

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default My CSS Won't Work On This Page

    Can anyone see why my htm and css won't work on this page? I have done like 10 pages in a row fine and this one just ignores the stylesheet entirely...

    PHP Code:
    <?php

    if(empty($_SESSION['session_started']))
    {
        
    session_cache_expire(120);
        
    session_start();
        
    $_SESSION['session_started'] = "TRUE";
    }

    /* connect to the mysql database and use different queries for the count of members */

    include 'library/config.php';
    include 
    'library/opendb.php';

    $info mysql_query("SELECT * from `tblrepresentatives`");
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <html>
    <head>
    <title>Members Status</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="cs_style.css" rel="stylesheet" type="text/css" />
    <body>
    <div id="wrap">
    <div id="header"><p>Hello <? echo $_SESSION['txtUserId']; ?>! You are now Logged in.<a href="index.php">Logout</a></p></div>
    <div id="nav"><?php include("nav.php"); ?></div>
    <div id="main">
    <p><img src="images/membership_status.png" alt="Membership Status"></p>
    <div id="container">
    <?php

    echo '<table width="700" border="0" cellspacing="0" cellpadding="0">
      <thead>
      <tr>
        <th scope="col" class="twenty">FIRST NAME</th>
        <th scope="col" class="twenty">LAST NAME</th>
        <th scope="col" class="twenty">MEMBERS</th>
        <th scope="col" class="twenty">EDIT</th>
        <th scope="col" class="twenty">&nbsp;</th>
      </tr>
      </thead>'
    ;
        
    //now check it for failure and display a decent error message if it did fail 
    if (!$info) { 
        die(
    "Query failed. Query text: $query<br />Error Message: ".mysql_error()); 
    }  

    else {
       while (
    $qry mysql_fetch_array($info)) {
    $i++;   

    $rep $qry['rep_NBR'];

    $members mysql_query("SELECT * FROM `tblmembers` WHERE `rep_NBR`='$rep'");

    $total_members mysql_num_rows($members);

    //create the layout
    ?>

     <tr valign="top" class="<?php echo $i 'odd' 'even'?>">
        <td><?php echo $qry['rep_Firstname']; ?></td>
        <td><?php echo $qry['rep_Lastname']; ?></td>
        <td><a href="showRepMembers.php?rep_id=<?=$qry['rep_NBR'];?>"><?=$total_members;?></a></td>
        <td><a href="showRepEdit.php?rep_id=<?php echo $qry['rep_NBR']; ?>">Edit</a></td>
        <td>Delete</td>
      </tr>
    <?php
       
    }
    }

    echo 
    '</table></div>
    </div>
    <div id="footer">
        <p>Footer</p>
    </div>
    </body>
    </html>'
    ;

    include 
    'library/closedb.php';

    ?>

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Code:
    <?php echo $i % 2 ? 'odd' : 'even'; ?>
    needs to be

    <?php if($i%2 == 0) ? echo 'odd' : echo 'even' ?>

    or

    <?php

    if($1%2 == 0) {
    echo "odd";
    }
    else {
    echo "even";
    }
    ?>

    they should produce the same thing

  3. #3
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    But the current code I'm using works is it incorrect?

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Yes
    PHP Code:
    <?php echo $i 'odd' 'even'?>
    This is incorrect. $i%2 must return 0 or 1, but what you are saying is if its true odd, if false then add the even clause. I didnt catch it the first time because I didnt take the time to look at it in depth... this code should be complete.

  5. #5
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok but then how come it works in my page?

  6. #6
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    you said that it wasnt working? and now you are saying it is working? I guess I am not following what you are saying... It is possible that the interpreter is correctly adjusting the statement, but there is ambiguity within it and syntactically it is not correct. What you have currently is checking whether its true or false, using the modular ( % ) function returns the remainder, in this case either a 1 or a 0. Now this is where I am guessing the interpreter is bugging, since 1 and 0 have dual uses.

    now as for the rest of your code, the only other `error` I can see off the top of my head is your query statement

    Code:
    $members = mysql_query("SELECT * FROM `tblmembers` WHERE `rep_NBR`='$rep'");
    I may be wrong but I do not believe mysql queries support operational equalities.

    Code:
    $members = mysql_query("SELECT * FROM `tblmembers` WHERE `rep_NBR` LIKE '$rep'");

Bookmarks

Posting Permissions

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