Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Posts posted by Lamez

  1. <?php
    $title = "My Page";
    echo '<html>';
    echo pageTitle($title);
    echo '<body>Ya My Body!</body></html>';
    
    function pageTitle($title){
      $t = '<head><title>'.$title.'</title></head>';
      return $t;
    }
    ?>
    

     

    returns like:

     

    <html><head><title>My Page</title><body>Ya My Body!</body></html>

     

    Something like that?

  2. try this:

     

    <?php 
    include('layout.inc');
    ?>
    
    <div style="position:absolute; top:110; left:252; width:500; height:300; z-index:1;">
    <p>
    <?php
    $servername= "localhost";
    $dbusername = "poetgos7_poetic";
    $dbpassword = "poetic";
    $dbname = "poetgos7_users";
    
    $connection = mysql_connect($servername, $dbusername, $dbpassword);
    $db = mysql_select_db($dbname, $connection);
    
    $name = $_POST['username'];
    $password = $_POST['password'];
    $password2 = $_POST['password2'];
    $email = $_POST['email'];
    $ip = $_POST['ip'];
    
    //if else (else if)
    if($name == false || $password == false || $password2 == false || $email == false){
    echo "You did not fill out all the required fields.  Please hit the back button and try again!";
    }
    if ($password != password2){
    echo "The passwords did not match!  Please hit the back button and try again!";
    }else{
    $connection = mysql_connect($servername, $dbusername, $dbpassword);
    $db = mysql_select_db($dbname, $connection);
    $sql = "INSERT INTO members (username, password, email, ip) VALUES ($username, $password, $email, $ip)";
    $result = mysql_query($sql);
    echo "Thank you for your registration to poetichotline.org!";
    }
    ?>
    </div>
    

  3. Ok I just created a INNER JOIN mysql query, and now it is causing a odd problem.

     

    This script is on the profile page, and it see if the user got the football team right, and if so it puts a check by the team name, and the point value. Well all the last game it shows everyone got it right, and it shows they got the points, but most did not. Why?

     

    Here is the main code:

    <?php
    if(siteStat() == "Football"){	 
     $q = mysql_query("SELECT foot_picks.* FROM foot_picks INNER JOIN foot_bowls ON foot_picks.id = foot_bowls.id ORDER BY foot_bowls.id");
    
    
    
     	   echo '<table width="100%" border="0">
      <tr>
        <td width="25%"><strong>Bowl Name </strong></td>
        <td width="25%"><strong>Pick</strong></td>
        <td width="25%"><strong>Correct</strong></td>
    <td width="25%"><center><strong>Points Earned</strong></center></td>
      </tr>';
      
    
         while($r = mysql_fetch_array($q)){
    
    
    
    $ts = mysql_query("SELECT * FROM `foot_win` WHERE `bowl_name` = '".$r['bowl_name']."'");
    $t = mysql_num_rows($ts);
    $pn = mysql_fetch_array($ts);
    
    $v = mysql_query("SELECT * FROM `foot_win` WHERE `team` = '".$r['team']."'")or die(mysql_error());
    $v = mysql_num_rows($v);
    
    $pa = mysql_query("SELECT * FROM `foot_bowls` WHERE `name` = '".$pn['bowl_name']."'")or die(mysql_error());
    $p = mysql_fetch_array($pa);
    
    if($t > 0){//1st IF
    
       if($v > 0){//Second IF
         $s = '<img src="'.$path.'main/style/img/c.png" />';
         $pnt = $p['pnt_val'];
    }else{//Second IF
        $s = '<img src="'.$path.'main/style/img/r.png" />';
        $pnt = "0";
    }//Secon IF
    
    }else{//1st IF
       $s = "";
       $pnt = "";
    }//1st IF
       
    $id = mysql_query("SELECT * FROM `foot_bowls` WHERE `name` = '".$r['bowl_name']."'");
    $id = mysql_fetch_array($id);
    $id = $id['id'];
    ?>
    <tr>
        <td><a href="<?php echo $path;?>user/foot/bowl.php?bowl_id=<?php echo $id; ?>"><?php echo $r['bowl_name']; ?></a></td>
        <td><?php echo $r['team']; ?></td>
        <td><?php echo $s; ?></td>
    <td><center><?php echo $pnt; ?></center></td>
    </tr>
    <?php
    
         }//end 1st loop
         echo '</table></p>';
    
     //Other Site Settings...
        }else
          if(siteStat() == "Basketball"){
           echo "BSKT";
        }else{
          echo "No Pools are Open";
        }
    }
    ?>
    

     

    Its the mysql querys at the beginning, but I think the main problem is that inner join query, does anybody have any idea why?

  4. The idea behind this bit of code is to take the previous submitted information, which are the winners of the foot bowl, then to find all the users that have picked that team to win. If they did pick that team, then it will (suppose) take the pnt value, and add it to the db in the foot_picks table, then take their total, and it it there, and update the foot_pnt table. Well nothing is being updated at all!

     

    here is the buggy code:

    <?php
    ob_start();
    $path = "../../";
    $u_login = "yes";
    $admin = "yes";
    $rank = "yes";
    include ($path."main/include/cons/head.php");
    $name = $_POST['name'];
    $team = $_POST['team'];
    $pnt = $_POST['pnt'];
    $q = mysql_query("SELECT * FROM `foot_picks` WHERE `team` = '".$team."' AND `bowl_name` = '".$name."'");
    while($f = mysql_fetch_array($q)){
    mysql_query("UPDATE `foot_picks` WHERE `team` = '".$team."' SET `pnt` = '".$pnt."'");
    $t = mysql_query("SELECT * FROM `foot_pnt` WHERE `user` = '".$f['user']."'");
    $n = mysql_fetch_array($t);
    $tot = $n['total'] + $pnt;
    mysql_query("UPDATE `foot_pnt` WHERE `user` = '".$f['user']."' SET `total` = '".$tot."'");
    }
    echo "All Done!";
    include ($path."main/include/cons/foot.php");
    ?>
    

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