Jump to content

BillyBoB

Members
  • Posts

    630
  • Joined

  • Last visited

    Never

Posts posted by BillyBoB

  1. I would think something like this:

    $qry = "SELECT `tut_rating` FROM `html_tuts` WHERE `tut_id`='$tut_id'";
    $rating = mysql_query($qry);
       
       if($rating['tut_rating'] == '0.00'){
       echo "<img src='Images/3.5.gif' width='70' height='18'>";
       }
       
       else{
       echo "error";
       }
    

  2. You are first going to have to name the items in the toolbar and change the javascript function button up a lil

    so for bold do

    <div onclick="button('bold')" class="button" id="boldBtn"><img title="Bold" alt="Bold" src="images/bold.png" class="image"></div>

     

    function button(a) {
    if(!document.getElementById(a+'Btn').style.backgroundColor) { document.getElementById(a+'Btn').style.backgroundColor = "#D5DDE5"; }else{ document.getElementById(a+'Btn').style.backgroundColor = null; }
    document.getElementById('editor').contentWindow.document.execCommand(a, false, null);
    document.getElementById('editor').contentWindow.focus();
    } 
    

     

    that should work for you.

     

    Good luck! Have fun

  3. So something like this:

    <?php
    $con = mysql_connect("localhost","virtu857_invoice","J497");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("virtu857_invoice", $con);
    
    $result = mysql_query("SELECT * FROM invoices") or die("Error: " . mysql_error());
    
    echo "<table border='1'>
    <tr>
    <th>ID</th>
    <th>Client ID</th>
    <th>Date Billed</th>
    <th>Date Due</th>
    <th>Date Paid</th>
    <th>Total</th>
    <th>Status</th>
    </tr>";
    
    while($row = mysql_fetch_array($result))
      {
      echo "<tr>";
      echo "<td>" . $row['id'] . "</td>";
      echo "<td>" . $row['clientid'] . "</td>";
      echo "<td>" . $row['bill_date'] . "</td>";
      echo "<td>" . $row['due_date'] . "</td>";
      echo "<td>" . $row['paid_date'] . "</td>";
      echo "<td>" . $row['total'] . "</td>";
      if($row['status']=="paid") {
        echo "<td style=\"color: green;\">$row[status]</td>";
      }else{
        echo "<td style=\"color: red;\">$row[status]</td>";
      }
      echo "</tr>";
      }
    echo "</table>";
    
    mysql_close($con);
    ?>
    

     

    Good luck

  4. simple error

    
    if ($_GET["start_time"] != NULL){
    
    
    
    $start_time_input = $_GET["start_time"];
    
    
    
    $start_tz = $_GET["start_tz"];
    
    
    
    $end_tz = $_GET["end_tz"];
    
    
    
    putenv("TZ=$start_tz"); // this line had an unclosed double quote
    
    
    
    $start_time = strtotime($start_time_input);
    
    
    
    echo "<strong>";   <--- Parse Error starts here. I can fix it by replacing with single quotes
    
    
    
    echo date("h:i:sA",$start_time)."\n";  <--- Also get the parse error here if I fix the above
    
    
    
    echo "</strong>";  <--- same parse error in this line... sigh... 
    
    
    
    putenv("TZ=$end_tz");
    

     

    also you don't need double quotes unless you intend on including a variable like echoing out something

     

    so $name = $_GET['name'] and echo("The name is: $name");

     

    Good Luck

  5. include_once() would be what you need for the connect page and I would set a variable in the stats page to let the rates page know not to include admin.

     

    rates.php here:

    <?php
    session_start();
    /// Include Admin Page Here ///
    if(!$_GET['admin']) include('inc/admin.php');
    include_once('inc/connect.php');
    
    $user = $_SESSION['username'];
    
    $sql = mysql_query("SELECT * FROM `users` WHERE `username` ='".$user."'");
    $row = mysql_fetch_assoc($sql);
    
    $sql2 = mysql_query("SELECT * FROM `userstats` WHERE `username` ='".$user."'") or die(mysql_error());
    $row2 = mysql_fetch_assoc($sql2);
    
    $member = $row['member'];
    $level  = $row2['level'];
    
    $addrate = .005;
    
    if ($member == 0) {
        $rate = ($level*$addrate+.50);
    
    
    
    $rate = number_format($rate, 3, '.', '');
    }
    
    if ($member == 1) {
        $rate = ($level*$addrate+1);
    
    
    
    $rate = number_format($rate, 3, '.', '');
    }
    
    if ($member == 9) {
        $rate = ($level*$addrate+1);
    
    
    
    $rate = number_format($rate, 3, '.', '');
    }
    
    ?>

     

    stats.php here:

    <?php
    session_start();
    if(isset($_SESSION['username'])){
    
    $username = $_SESSION['username'];
    
    include_once('inc/connect.php');
    include ('rates.php?admin=false');
        $statssql = mysql_query("SELECT * FROM `userstats` WHERE `username`='$username'"); 
        $row = mysql_fetch_assoc($statssql); 
    
    
    }
    else{
    
    
    
    header("Location: index.php");
    }
    ?>
    <html>
    <head>
    <title>Stats</title>
    <link rel="stylesheet" type="text/css" href="styles/stats.css" />
    </head>
    <body>
    
    </body>
    </html>

     

    I usually build a functions or classes page which takes cares of connecting to the database and checking members permissions. so then you just include_once('functions.php'); and you have it to use.

     

    Good luck! Have fun.

  6. That or

     

    <?php if ($show_form == 1) {
    echo("
      <form id=\"add_category\" name=\"add_category\" method=\"post\" action=\"\" class=\"form\">
        <input type=\"text\" id=\"category\" name=\"category\" style=\"width:400px\" maxlength=\"100\" title=\"Enter a new category name here\" value=\"".$_POST['category']?$_POST['category']:''."\" />
        <input type=\"submit\" id=\"submit\" name=\"submit\" class=\"submit\" value=\"Submit\"/>
      </form>
    ");
    }
    ?>
    

  7. Try just changing the html up.

     

    <?php
    $dir = 'path/to/dir';
    
    // List of file names to exclude from output
    // NOTE: This is case-sensitive
    $exclude = array('somefile.php', 'somedir');
    
    // Check to see if $dir is a valid directory
    if (is_dir($dir)) {
      $contents = scandir($dir);
      
      echo '<select>';
    
      foreach($contents as $file) {
        // This will exclude all filenames contained within the $exclude array
        // as well as hidden files that begin with '.'
        if (!in_array($file, $exclude) && substr($file, 0, 1) != '.') {
          echo '<option>'. $file .'</option>';
        }
      }
      
      echo '</select>';
    }
    else {
      echo "The directory <strong>". $dir ."</strong> doesn't exist.";
    }
    ?>
    

     

    There ya go :D

  8. if you want the html in the bottom of the page to load you cannot exit the php script that stops the page from loading.

     

    Simple solution delete exit;

     

    and if you didn't want the rest of the script to load also then use }else{ non loading script }

     

    
    <html>
        <head><title>Adding Fixtures</title></head>
        <body style="background-color:grey; font-family:arial; color:white;">
            
    <center> <table>
             <tr><td>
                <form action="add_fixtures.htm" method="post">
            
            <?php
            
            require_once("database_connect.php");
            
            $home_team = $_POST['Home_Team_Fixture'];
            $away_team = $_POST['Away_Team_Fixture'];
    
            
            $fixture = $home_team." v ".$away_team;
            
       if($home_team == $away_team) {
         
         echo "Your not allowed to enter the same team.";
    }else{
    
            $check_query = "SELECT * FROM Fixtures WHERE Fixture ='$fixture'";
    
            $checking = mysql_query($check_query);
            $check = mysql_fetch_array($checking);
            
            if($check) {
                
            echo "This Fixture is Already In Place";
    
            } else  {
    
           $query = mysql_query("INSERT INTO Fixtures (Fixture) VALUES ('$fixture')");
            
           if($query) {
                
                echo "You've successfully added the $fixture fixture into the league";
            }
    } }
          
            ?>
            
            <input type="submit" name="Add_Another_Fixture" value="Add Another Fixture"> 
            </form>
            </td>
                
            <td>
                <form action="view_fixtures.php" method="post">
                <input type="submit" name="View_Fixtures" value="View Fixtures"> </form>
            
            </td> </tr>
            </table> </center>
    
    </body>
    </html>
    

  9. i would say that it is a php timestamp.

     

    the solution to that would be

    <?php
    $connection = mysql_connect("localhost", "imissth1_phpb4", "[1E199M[1y8W") or die("Service Temporarily Unavailable");
    $db = mysql_select_db("imissth1_phpb4",$connection) or die("Service temporairly unavailable");
    $sql = "select * from phpbb_topics order by topic_last_post_time desc limit 0,10";
    $result = mysql_query($sql) or die("Service temporairly unavailable");
    for($x=1;$x<=10;$x++){
       $row = mysql_fetch_array($result);
       echo "<a href = \"http://www.codenamekingdom.com/forum/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]\" target = \"_blank\">$row[topic_title]</a><br>Last Posted in by: $row[topic_last_poster_name]<br>On: ".date("d-m-y h:i:s", $row['topic_last_post_time'])."<br><br>";
    }
    ?>
    

  10. when you look into the database can you find the column topic_last_post_time and see what type it is.

     

    if the date is stored with php timestamp values then its type would be string...

     

    your end code would look like

    <?php
    $connection = mysql_connect("localhost", "imissth1_phpb4", "[1E199M[1y8W") or die("Service Temporarily Unavailable");
    $db = mysql_select_db("imissth1_phpb4",$connection) or die("Service temporairly unavailable");
    $sql = "select * from phpbb_topics order by topic_last_post_time desc limit 0,10";
    $result = mysql_query($sql) or die("Service temporairly unavailable");
    for($x=1;$x<=10;$x++){
       $row = mysql_fetch_array($result);
       
       echo "<a href = \"http://www.codenamekingdom.com/forum/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]\" target = \"_blank\">$row[topic_title]</a><br>Last Posted in by: $row[topic_last_poster_name]<br>On: $row[topic_last_post_time]<br><br>";//you may need to convert the time into a workable string...
    }
    ?>
    

  11. use this code to echo it

     

    <?php
    $connection = mysql_connect("localhost", "imissth1_phpb4", "[1E199M[1y8W") or die("Service Temporarily Unavailable");
    $db = mysql_select_db("imissth1_phpb4",$connection) or die("Service temporairly unavailable");
    $sql = "select * from phpbb_topics order by topic_last_post_time desc limit 0,10";
    $result = mysql_query($sql) or die("Service temporairly unavailable");
    for($x=1;$x<=10;$x++){
       $row = mysql_fetch_array($result);
       print_r($row);// this will print everything in the array including the array name
       echo "<a href = \"http://www.codenamekingdom.com/forum/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]\" target = \"_blank\">$row[topic_title]</a><br><br>";
    }
    ?>
    

×
×
  • 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.