Jump to content

seaweed

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Posts posted by seaweed

  1. Why wouldn't you sort by an auto-incrementing field? Applications like phpBB and WordPress do it all the time with postID etc. phpBB sorts their memberlist by the auto-incrementing field 'userid' by default.

     

    My question is, why does SELECT MAX(project_id) work and SELECT MAX($maxField) not work, when they technically hold the same value?

     

     

  2. I have a table that uses an auto-increment field, and requires a second auto-increment, which isn't allowed in MySQL. So I tried to query the db for the 2nd variable, grab the highest value and add 1, but it will not work with a $variable in the query string. Any idea why? And before you ask, I need the second auto-increment because the data from this table is being split into two display sections, each needs to be user-sorted with a toggle. Also, $tableselect is passed a value, from the $_POST method.

     

    This works:

     

     // 
    $maxTable = $_SESSION['username'] . "_projects";
    
    $maxResult = mysql_query("SELECT MAX(project_id) FROM $maxTable")
         or die(mysql_error());
    
         while($row = mysql_fetch_array( $maxResult )) {
              $maxdata = $row['MAX(project_id)'];
      $maxdata1 = $maxdata + 1;
    }
    

     

    This does not work:

     

     // 
    $maxTable = $_SESSION['username'] . "_projects";
    $maxField = $tableselect . "_id";
    
    $maxResult = mysql_query("SELECT MAX($maxField) FROM $maxTable")
         or die(mysql_error());
    
         while($row = mysql_fetch_array( $maxResult )) {
              $maxdata = $row['MAX($maxField)'];
      $maxdata1 = $maxdata + 1;
    }
    

  3. After executing a script I want to re-route the user back to the page they were on, but jump down to a specific part of the page. What is the syntax to add an anchor to the end of a php url?

     

    Right now I have:

     

    header("Location: project.php);

      exit;

     

    Basically I want it to be:

     

    header("Location: project.php#$panel");

      exit;

     

    where $panel is the specific part of the page they were on.

     

    The page uses anchor tags like <div id="part1"> etc.

     

     

  4.               <div class=\"cell_browsers_assigned_to\">$phppt_browsers_assigned_to</div>

    <div class=\"cell_browsers_status\">$phppt_browsers_status</div>

    </div>";

    }

    echo "</div>";  <-- not sure what this closes?

     

     

    It closes <div "browsers">... each section has its own little panel container.

  5. In many of the sections I see an opening

     

    <div> followed by a group of same line

        <div>(info)</div>

    </div>

     

    But then I don't get the echo </div> after some of the sections? (Or did I miss that those were if/then statements? oops)

     

    Which lines do you mean?

     

    You should try adding a div after the php close statement where you clear the floats. That's probably the problem.

     

              <?php mysql_close......

          <div class="clear"></div>

      </div>

    </div>

     

    CSS...

    .clear {

    clear:both;

    }

     

    This did not help, but thanks!

  6. Maybe I am just tired but I cannot find the cause of this error. Look at the bottom of my screenshot, the "wrap" DIV doesn't go all the way down. I've messed with the height of html, body and wrap. Any other ideas?

     

    Validation at W3C finds an extra DIV tag on line 151 but it isn't there.

     

    phpptscreen.jpg

     

    CSS

     

    * {
    /* Reset browsers default margin, padding and font sizes */
    margin: 0;
    padding: 0;
    }
    
    html {
    height: 100%; 
    margin-top: 20px;
    padding-bottom: 20px;
    }
    
    body {
    font-family: Verdana, Helvetica, Arial, sans-serif;
    color: #000000;
    background-color: #222222;
    font-size: 10px;
    text-align: center;
    padding: 4px 0;
    height: 100%;
    margin-bottom: 20px;
    }
    
    h3 {
    font-family: Verdana, Helvetica, Arial, sans-serif;
    font-weight: bold;
    font-size: 13px;
    width: 770px;
    text-align: left;
    border-bottom: 1px solid #333366;
    background-color: #CCCCFF;
    padding-left: 2px;
    }
    
    .wrap {
        width: 800px;
        min-height: 800px;
        background-color: #cccccc;
    margin-left: auto;
        margin-right: auto;
    clear: both;
    display: block;
    }
    
    .header {
        width: 792px;
        height: 85px;
        margin: 4px 4px 4px 4px;
        padding: 0;
        float: left;
    background-color: #ffffff;
    background-image: url('images/header.gif');
    }
    
    .navbar {
        width: 792px;
        height: 22px;
        margin: 0 4px 4px 4px;
        padding: 5px 0 0 0;
        float: left;
    background-color: #333366;
    color: #666699;
    text-align: left;
    }
    
    a.navbarlink {
        color: #ffffff;
    }
    
    a.navbarlink:hover {
        color: #dcdcdc;
    }
    
    .panel {
        width: 772px;
    height: 100%; 
        margin: 0 4px 0px 4px;
        padding: 30px 10px 10px 10px;
        float: left;
    background-color: #ffffff;
    color: #000000;
    }
    
    /* Project Features Panel */
    .features {
        width: 772px;
    min-height: 100px; 
    background-color: #ffffff;
    color: #000000;
    float: left;
    text-align: left;
    margin-bottom: 10px;
    }
    
    /* Project Features Table */
    
    .row {
        width: 772px;
    height: 22px;
    float: left;
    border-bottom: solid 1px #000000;
    clear: both;
    }
    
    .cell_id {
        width: 30px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_title {
        width: 300px;
    height: 22px;
    text-align: left;
    display: inline;
    float: left;
    padding-left: 12px;
    padding-top: 4px;
    }
    
    .cell_assigned_to {
        width: 150px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_resource_estimate {
        width: 100px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_status {
        width: 150px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_status_icon {
        width: 20px;
    height: 22px;
    text-align: center;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .row_header {
        width: 772px;
    height: 24px;
    float: left;
    border-bottom: solid 1px #000000;
    clear: both;
    font-weight: bold;
    }
    
    .cell_id_header {
        width: 30px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_title_header {
        width: 300px;
    height: 22px;
    text-align: left;
    display: inline;
    float: left;
    font-weight: bold;
    padding-left: 12px;
    }
    
    .cell_assigned_to_header {
        width: 150px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_resource_estimate_header {
        width: 100px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_status_header {
        width: 150px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_status_icon_header {
        width: 20px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .issues {
        width: 772px;
    min-height: 100px;
    background-color: #ffffff;
    color: #000000;
    float: left;
    text-align: left;
    margin-bottom: 10px;
    }
    
    .bugs {
        width: 772px;
    min-height: 100px;
    background-color: #ffffff;
    color: #000000;
    float: left;
    text-align: left;
    margin-bottom: 10px;
    }
    
    .browsers {
        width: 772px;
    min-height: 100px;
    background-color: #ffffff;
    color: #000000;
    float: left;
    text-align: left;
    margin-bottom: 10px;
    }
    
    .cell_browsers_icon_header {
        width: 30px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_browsers_id_header {
        width: 20px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_browsers_os_header {
        width: 300px;
    height: 22px;
    text-align: left;
    display: inline;
    float: left;
    font-weight: bold;
    padding-left: 12px;
    }
    
    .cell_browsers_browser_header {
        width: 100px;
    height: 22px;
    text-align: left;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_browsers_version_header {
        width: 50px;
    height: 22px;
    text-align: left;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_browsers_resolution_header {
        width: 50px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_browsers_assigned_to_header {
        width: 150px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    
    .cell_browsers_status_header {
        width: 250px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    font-weight: bold;
    }
    
    .cell_browsers_icon {
        width: 30px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_browsers_id {
        width: 20px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_browsers_os {
        width: 300px;
    height: 22px;
    text-align: left;
    display: inline;
    float: left;
    padding-top: 4px;
    padding-left: 12px;
    }
    
    .cell_browsers_browser {
        width: 100px;
    height: 22px;
    text-align: left;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_browsers_version {
        width: 50px;
    height: 22px;
    text-align: left;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_browsers_resolution {
        width: 50px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_browsers_assigned_to {
        width: 150px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    
    .cell_browsers_status {
        width: 250px;
    height: 22px;
    text-align: right;
    display: inline;
    float: left;
    padding-top: 4px;
    }
    

     

     

    HTML / PHP

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <?php
        include 'config.php';
        include 'opendb.php';
      ?>
    <HTML>
      <HEAD>
        <TITLE>PHP Project Tracker</TITLE>
          <META NAME="Generator" CONTENT="EditPlus">
          <META NAME="Author" CONTENT="">
          <META NAME="Keywords" CONTENT="">
          <META NAME="Description" CONTENT="">
          <LINK rel="stylesheet" type="text/css" name="style" href="style.css">
        </HEAD>
    
        <BODY>
          <div class="wrap">
            <div class="header"></div>
            <div class="navbar">
                 
    	  <a href="home.php" class="navbarlink">Home</a>   |   
    	  <a href="projects.php" class="navbarlink">Projects</a>   |   
    	  <a href="tasklist.php" class="navbarlink">Task List</a>
    	</div>
    	<div class="panel">
    	  <?php
    	  // Start Features Panel //
    		echo "
    		<div class=\"features\">
    		<h3>Feature Requests</h3><br />";
    
    	  // Query features table //
    		$features_result = mysql_query("SELECT * FROM features")
    		or die(mysql_error());
    
    		echo "
    		<div class=\"row_header\">
    		<div class=\"cell_status_icon_header\"></div>
    		<div class=\"cell_id_header\">ID</div>
    		<div class=\"cell_title_header\">Feature Description</div>
    		<div class=\"cell_assigned_to_header\">Assigned To</div>
    		<div class=\"cell_resource_estimate_header\">Time Est.</div>
    		<div class=\"cell_status_header\">Status</div>
    		</div>";
    
    	  // Populate data rowsfor features //
    		while($row = mysql_fetch_array( $features_result )) {
    
    	  // Features field data //
    		$phppt_features_status_icon = $row["phppt_features_status_icon"];
    		$phppt_features_id = $row["phppt_features_id"];
    		$phppt_features_title = $row["phppt_features_title"];
    		$phppt_features_assigned_to = $row["phppt_features_assigned_to"];
    		$phppt_features_status = $row["phppt_features_status"];
    		$phppt_features_resource_estimate = $row["phppt_features_resource_estimate"];
    
    		echo "
    		<div class=\"row\">
    		<div class=\"cell_status_icon\"><img src=\"images/$phppt_features_status_icon\" /></div>
    		<div class=\"cell_id\">$phppt_features_id</div>
    		<div class=\"cell_title\"><a href=\"feature.php&f=$phppt_features_id\">$phppt_features_title</a></div>
    		<div class=\"cell_assigned_to\">$phppt_features_assigned_to</div>
    		<div class=\"cell_resource_estimate\">$phppt_features_resource_estimate</div>
    		<div class=\"cell_status\">$phppt_features_status</div>
    		</div>";
    		}
    		echo "</div>";
    
          //End Features Panel //
    
    	  //Start Bugs Panel //
    		echo "
    		<div class=\"bugs\">
    		<br /><br /><br /><br />
    		<h3>Bug Tracker</h3><br />";
    
    	  // Query bugs table //
    		$bugs_result = mysql_query("SELECT * FROM bugs")
    		or die(mysql_error());
    
    		echo "
    		<div class=\"row_header\">
    		<div class=\"cell_status_icon_header\"></div>
    		<div class=\"cell_id_header\">ID</div>
    		<div class=\"cell_title_header\">Bug Description</div>
    		<div class=\"cell_assigned_to_header\">Assigned To</div>
    		<div class=\"cell_resource_estimate_header\">Time Est.</div>
    		<div class=\"cell_status_header\">Status</div>
    		</div>";
    
    	  // Populate data rows for bugs//
    		while($row = mysql_fetch_array( $bugs_result )) {
    
    	  // bugs table fields //
    		$phppt_bugs_status_icon = $row["phppt_bugs_status_icon"];
    		$phppt_bugs_id = $row["phppt_bugs_id"];
    		$phppt_bugs_title = $row["phppt_bugs_title"];
    		$phppt_bugs_assigned_to = $row["phppt_bugs_assigned_to"];
    		$phppt_bugs_status = $row["phppt_bugs_status"];
    		$phppt_bugs_resource_estimate = $row["phppt_bugs_resource_estimate"];
    
    		echo "
    		<div class=\"row\">
    		<div class=\"cell_status_icon\"><img src=\"images/$phppt_bugs_status_icon\" /></div>
    		<div class=\"cell_id\">$phppt_bugs_id</div>
    		<div class=\"cell_title\"><a href=\"bug.php&b=$phppt_bugs_id\">$phppt_bugs_title</a></div>
    		<div class=\"cell_assigned_to\">$phppt_bugs_assigned_to</div>
    		<div class=\"cell_resource_estimate\">$phppt_bugs_resource_estimate</div>
    		<div class=\"cell_status\">$phppt_bugs_status</div>
    		</div>";
    		}
    		echo "</div>";
    
    	  // End Bugs Panel //
    
    	  // Start Issues Panel //
    		echo "
    		<div class=\"issues\">
    		<br /><br /><br /><br />
    		<h3>Uncategorized Issues</h3><br />";
    
    	  // Query issues table //
    		$issues_result = mysql_query("SELECT * FROM issues")
    		or die(mysql_error());
    
    		echo "
    		<div class=\"row_header\">
    		<div class=\"cell_status_icon_header\"></div>
    		<div class=\"cell_id_header\">ID</div>
    		<div class=\"cell_title_header\">Issue Description</div>
    		<div class=\"cell_assigned_to_header\">Assigned To</div>
    		<div class=\"cell_resource_estimate_header\">Time Est.</div>
    		<div class=\"cell_status_header\">Status</div>
    		</div>";
    
    	  // Populate data rows for issues //
    		while($row = mysql_fetch_array( $issues_result )) {
    
    		// issues table fields //
    		$phppt_issues_status_icon = $row["phppt_issues_status_icon"];
    		$phppt_issues_id = $row["phppt_issues_id"];
    		$phppt_issues_title = $row["phppt_issues_title"];
    		$phppt_issues_assigned_to = $row["phppt_issues_assigned_to"];
    		$phppt_issues_status = $row["phppt_issues_status"];
    		$phppt_issues_resource_estimate = $row["phppt_issues_resource_estimate"];
    
    		echo "
    		<div class=\"row\">
    		<div class=\"cell_status_icon\"><img src=\"images/$phppt_issues_status_icon\" /></div>
    		<div class=\"cell_id\">$phppt_issues_id</div>
    		<div class=\"cell_title\"><a href=\"issues.php&i=$phppt_issues_id\">$phppt_issues_title</a></div>
    		<div class=\"cell_assigned_to\">$phppt_issues_assigned_to</div>
    		<div class=\"cell_resource_estimate\">$phppt_issues_resource_estimate</div>
    		<div class=\"cell_status\">$phppt_issues_status</div>
    		</div>";
    		}
    		echo "</div>";
    
    		// Start Browsers Panel //
    		echo "
    		<div class=\"browsers\">
    		<br /><br /><br /><br />
    		<h3>Browser Compatibility</h3><br />";
    
    	  // Query browsers table //
    		$browsers_result = mysql_query("SELECT * FROM browsers")
    		or die(mysql_error());
    
    		echo "
    		<div class=\"row_header\">
    		<div class=\"cell_browsers_icon_header\"></div>
    		<div class=\"cell_browsers_id_header\">ID</div>
    		<div class=\"cell_browsers_os_header\">Operating System</div>
    		<div class=\"cell_browsers_assigned_to_header\">Assigned To</div>
    		<div class=\"cell_browsers_status_header\">Status</div>
    		</div>";
    
    	  // Populate data rows for browsers
    		while($row = mysql_fetch_array( $browsers_result )) {
    
    	  // browsers table fields //
    		$phppt_browsers_status_icon = $row["phppt_browsers_status_icon"];
    		$phppt_browsers_id = $row["phppt_browsers_id"];
    		$phppt_browsers_os = $row["phppt_browsers_os"];
    		$phppt_browsers_browser = $row["phppt_browsers_browser"];
    		$phppt_browsers_version = $row["phppt_browsers_browser_version"];
    		$phppt_browsers_resolution = $row["phppt_browsers_resolution"];
    		$phppt_browsers_assigned_to = $row["phppt_browsers_assigned_to"];
    		$phppt_browsers_status = $row["phppt_browsers_status"];
    
    		echo "
    		<div class=\"row\">
    		<div class=\"cell_browsers_icon\"><img src=\"images/$phppt_browsers_status_icon\" /></div>
    		<div class=\"cell_browsers_id\"><a href=\"browser.php&v=$phppt_browsers_id\">$phppt_browsers_id</a></div>
    		<div class=\"cell_browsers_os\">$phppt_browsers_os / $phppt_browsers_browser $phppt_browsers_version / $phppt_browsers_resolution</div>
    		<div class=\"cell_browsers_assigned_to\">$phppt_browsers_assigned_to</div>
    		<div class=\"cell_browsers_status\">$phppt_browsers_status</div>
    		</div>";
    		}
    		echo "</div>";
    	?>
    
    	  <?php mysql_close($con); ?>
        </div>
      </div>
        </BODY>
    </HTML>

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.