SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 48 of 48
  1. #26
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for logging the dates of each rating, how would i do it?

    I think I create a field in my ratings table in mySQL using the date format thing, but beyond trhat I'm not sure how to use it.

    are there any good tutorials someone could direct me to?


    also, how do I script it so the most recent 5 are shown and a "show all" button/option?

    once I get the order correct, and when I get the cookies right, my rating system should be complete.

    I've also decided to add a an avg rating. I'm pretty sure I know how to do this:

    I need to set a database table that tells me how many votes there have been. what kind of table type and other settings do I need to set?

    as the avg rating progresses i will bring up more issues.
    Last edited by aaazx; Nov 29, 2003 at 22:22.

  2. #27
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its quite simple to log the time.

    Just create a timestamp field in your database. And then when you add a row to the database, use CUR_TIMESTAMP() to add the timestamp to your database field.

  3. #28
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok im trying to do the date order thing, and im having a problem. what do I write for the current date here:

    PHP Code:
                 <textarea name="comment" cols="50" rows="7"></textarea>
                  </
    div></td>
                          </
    tr>
                        </
    table>
                        <
    input type="hidden" name="date" value="SCRIPTFORCURRENTDATE">
    <
    input type="submit" name="Submit" value="Submit">
    </
    form>
                    
                    </
    td
    if im not doing this right please tell me.

    heres the coding for the order:

    PHP Code:
    <?PHP
        $dbh
    =mysql_connect ("localhost""francis_rate""rate") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db ("francis_ratings");
    $sql "SELECT
    date,
    name,
    email,
    rating,
    comment
    FROM
    ratings
    ORDER by date DESC
    "
    ;

    coding continues
    all of the above coding is from rate.php

    here is rateprocess.php

    PHP Code:
    <? 
    setcookie
    (alreadyrated$alreadyrated);
    ?>

    <html>
    <head>
    <title>RATE PROCESS</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    </head>

    <body bgcolor="#FFFFFF" text="#000000" link="#666666">
    <?PHP




     

    if (isset($alreadyrated)) {

    echo (
    "Sorry, you have already rated.<BR><BR>");

    } elseif (empty(
    $name) || empty($email) || empty($rating) || empty($comment)) {

         

        echo 
    "<font face='Tahoma' size='2'>Please fill in all necessary forms.</font><BR><BR>";

        } else { 
        

    echo 
    "<META HTTP-EQUIV='refresh' CONTENT='0; URL=rate.php'>"
        
            
    $dbh=mysql_connect ("localhost""francis_rate""rate") or die ('I cannot connect to the database because: ' mysql_error());
        
    mysql_select_db ("francis_ratings");
        
    $sql "INSERT INTO ratings
    (
    date,
    name,
    email,
    rating,
    comment,
    ) VALUES
    (
    '
    $date',
    '
    $name',
    '
    $email',
    '
    $rating',
    '
    $comment',
    )"
    ;
    $sql_result mysql_query($sql,$dbh) or die ('Could not insert data.');
    mysql_close($dbh);



    echo 
    "<font face='Tahoma' size='2'>Thank you for your rating.</font><BR><BR>";

    }

    ?>
    <A HREF="javascript:history.go(-1)"> <font size="2" face="Tahoma">Back</font></A> 
    </body>
    </html>
    so far its not working.

  4. #29
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dont use a hidden field, you've got the wrong idea. Current date is inserted only when you run your insert query. For example here is a query I've just done:

    PHP Code:
    $sql "INSERT INTO players SET club='$club', value='$value', position='$position', age='$age', nationality='$nationality', side='$side', estbuy='$estbuy', name='$name', datedded=CURRENT_TIMESTAMP(), hits='0', gameid='0', notes='$notes'"

  5. #30
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i got the order working, the show 5 latest working, and the show all working. thanks.

    my last big problem is with the cookies and preventing people to vote over and over again. I am still confused about setting cookies?

  6. #31
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also what do I script so I dont have to create so many different tables in order to use the rate system? I am planning to use it for several differnet things, and I don't want to have to create an individual table for every single thing I am planning to rate. how do I make it so I don't need a table for each thing i want to rate?

  7. #32
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. What are you confused about? Just use set cookie and then use an if to see whether the cookie is set.

    Set cookie is in the form

    PHP Code:
    setcookie("cookiename"cookiecontenttime_expire); 
    Then to test for the cookie you could say:

    PHP Code:
    if( isset($_COOKIE['cookiename']) ) {
    DISPLAY ALREADY VOTED MESSAGE

    2. You would have to use a function for this. You could delve into classes and OOP, but I always prefer to use functions as they are so simple.

    Just say something like:
    PHP Code:
    function listratings() {

    DO 
    DATABASE QUERY AND LIST RESULTS


    then to call the function just put:
    PHP Code:
    listratings() 
    wherever you want to display the list of ratings.

    You should get the idea..

  8. #33
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    alright thanks, the cookies are working now!

    ...now i just need to figure out how to get the avg rating.

  9. #34
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good to hear it..working out the average should be simple enough, just divide the total cumalitive ratings by a mysql_num_rows of all the ratings made for that object..to get your average.

  10. #35
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    alright i got that working too....its all working fine...I am going to try to work out the ids so that I only have to use one table in a database instead of several.

    thanks

  11. #36
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, before I continue working on the ids, I want to get my page format right. it used to be fine, but whne I inserted the php coding, it blew the middle part out of proportion to the rest.

    here is what the pages looked like without the coding:

    http://garage.noammo.org/bands/superdelightful/

    notice how the center part (with the whitebackground) is aligned with the header and navigation bar and the copyright information at the bottom.

    here it is WITH the coding:

    http://garage.noammo.org/bands/selkin/

    notice how that center part is now wider. what's wrong?




    also.... why are the averages off? the average of those two ratings should be 3, but it says 2.5.

  12. #37
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the coding of the page with the rating system

    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>the garage | bands.selkin</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    <STYLE type=text/css>
    A:link {
        COLOR: #666666
    }
    A:visited {
        COLOR: #666666
    }
    A:hover {
        COLOR: #cccccc
    }
    </STYLE>



    </head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="description" content="The Garage is a network designed to give bands exposure and distribution among network points, as well as cheap studio fees for all Garage studios.">
    </head>

    <BODY BGCOLOR=#006699 text="#000000" link="#666666" vlink="#666666" alink="#666666" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
    <!-- HEADER -->
    <table width="800" cellspacing="0" cellpadding="0" align="center">
    <tbody>

        <tr> 
     
          <td width="800" height="141" valign="top"> <img src="../../images/thegarage.gif" alt="the garage" width="800" height="140">
          <img src="../../images/divider.gif" width="100%" height="1"></td>
      </tr>
      
      <!-- NAVIGATION -->
      <tr>
          <td bgcolor="#0066CC" height="44"> 
            <table width="798">
                <td width="61" height="38" bgcolor="#0066CC"><a href="../../index.php"
    onMouseOver="document.news.src='../../images/nav_newson.gif';" onMouseOut="document.news.src='../../images/nav_news.gif';"> 
                  <img src="../../images/nav_news.gif" width="60" height="24" name="news" border="0"></a> 
                </td>
                <td width="76" height="38" bgcolor="#0066CC"><a href="../../about" 
    onMouseOver="document.about.src='../../images/nav_abouton.gif';" onMouseOut="document.about.src='../../images/nav_about.gif';"> 
                  <img src="../../images/nav_about.gif" height="24" name="about" border="0"></a> 
                </td>
                <td width="76" height="38" bgcolor="#0066CC"><a href="../../store" 
    onMouseOver="document.store.src='../../images/nav_storeon.gif';" onMouseOut="document.store.src='../../images/nav_store.gif';"> 
                  <img src="../../images/nav_store.gif" name="store" border="0"></a> </td>
                <td width="71" height="38" bgcolor="#0066CC"><a href="../../media" 
    onMouseOver="document.media.src='../../images/nav_mediaon.gif';" onMouseOut="document.media.src='../../images/nav_media.gif';"> 
                  <img src="../../images/nav_media.gif" name="media" border="0"></a> </td>
                <td width="76" height="38" bgcolor="#0066CC"><a href="../../shows" 
    onMouseOver="document.shows.src='../../images/nav_showson.gif';" onMouseOut="document.shows.src='../../images/nav_shows.gif';"> 
                  <img src="../../images/nav_shows.gif" name="shows" border="0"></a> </td>
                <td width="102" height="38" bgcolor="#0066CC"> <a href="../../contact" 
    onMouseOver="document.contact.src='../../images/nav_contacton.gif';" onMouseOut="document.contact.src='../../images/nav_contact.gif';"> 
                  <img src="../../images/nav_contact.gif" name="contact" border="0"></a> 
                </td>
                <td width="66" height="38" bgcolor="#0066CC"> <a href="../../links" 
    onMouseOver="document.links.src='../../images/nav_linkson.gif';" onMouseOut="document.links.src='../../images/nav_links.gif';"> 
                  <img src="../../images/nav_links.gif" name="links" border="0"></a> </td>
      <td width="162">
      
        <!-- BANDS -->
        <table width="162" border="0" cellpadding="4" cellspacing="2" bgcolor="#0066CC">
        <tr>
            <FORM name=bandselecta action=# method=post>
        <TD width="150" align=left><SELECT style="WIDTH: 150px" 
          onchange=location.href=options[selectedIndex].value; name=iBandId> 
            <OPTION selected>Bands</OPTION> 
        
            <OPTION 
            value=http://garage.noammo.org/bands/noammo>No Ammo</OPTION>

            <OPTION 
            value=http://garage.noammo.org/bands/selkin>Selkin</OPTION>
                <OPTION 
            value=http://garage.noammo.org/bands/superdelightful>Super Delightful</OPTION>
            
                        <OPTION 
            value=http://garage.noammo.org/bands/twosamurai>The Two Samurai</OPTION>
            </SELECT>
            </TD></FORM>
            </tr>
            </table></td>
                <td width="68" height="38" bgcolor="#0066CC">&nbsp; </td>
      </tr>
      </table>
      
      
      </td>
      </tr>
      </table>
      
      
    <!-- CONTENT -->
    <table width="800" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF" height="700">
     
        <td width="165" height="268" bgcolor="#FFFFFF" valign="top"> 
          <!-- RELEASES -->
          <table width="140" border="0" cellpadding="4" cellspacing="2">
                  <tr> 
              <td height="32" bgcolor="#0066CC" width="150"><img src="../../images/releases.gif"></td>
            </tr>
            <!-- RELEASES INFO -->
            <tr>
              <td height="100%" bgcolor="#E9E9E9"> 
                <table width="100%">
      <tr>
                    <td width="100%" align="center"> <img src="../../images/albums/keeponplayin.gif" width="121" height="114"></td>
                  </tr>
    </table>
                  <table>
                     <tr>
                    <td><img src="../../images/divider.gif" width="100%" height="1"></td>
                  </tr>
                  <tr>
                   
        <td width="92%"><p><font size="1" face="Verdana, Arial, Helvetica, sans-serif, Alpha Romanie Outline G98, Alpha Sentry, Volt"><strong>Selkin - Keep On Playin'</strong></font></p>
                      <p><font face="Arial, Arial Black, Arial Narrow"><strong><font size="1">-</font></strong><font size="1">The 
                        first album from the alt. rock band from Ennis, Texas. From 
                        local fan reactions, this band's album will defintely be worth 
                        getting. </font></font></p></td>
      </tr>
       <tr>
                    <td><img src="../../images/divider.gif" width="100%" height="1"></td>
                  </tr>
      <tr>
      
                    <td> <font size="1" face="Verdana, Arial, Helvetica, sans-serif, Alpha Romanie Outline G98, Alpha Sentry, Volt"><strong>Track 
                      Listing: </strong></font> </td>
                  </tr>
                     <tr>
                    <td><img src="../../images/divider.gif" width="100%" height="1"></td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">1. Hideaway </font> </td>
                  </tr>
                  <tr>
                    <td> <font size="1" face="Tahoma">2. Believe </font> </td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">3. Keep On Playin'</font></td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">4. Age of End</font></td>
                  </tr>
                  <tr>
                     <td><font size="1" face="Tahoma">5. In My Eyes </font> </td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">6. Layin' Low</font></td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">7. As One</font></td>
                  </tr>
                   <tr>
                    <td><font size="1" face="Tahoma">8. Memory</font></td>
                  </tr>
                   <tr>
                    <td><font size="1" face="Tahoma">9. Along the Way</font></td>
                  </tr>
                  
                  </table>
              </td>
            </tr>
          </table>
          
          <!-- OTHER RELEASES -->
      <table width="140" border="0" cellpadding="4" cellspacing="2">
                  <tr> 
              <td height="32" bgcolor="#0066CC" width="150"><img src="../../images/otherreleases.gif" width="150" height="24"></td>
            </tr>
            <!-- OTHER RELEASES INFO -->
            <tr>
              <td height="100%" bgcolor="#E9E9E9"> 
                <table width="100%">
     
                   <tr>
                    <td><font size="1" face="Tahoma">no other releases</font></td>
                  </tr>
                  
                  </table>
              </td>
            </tr>
          </table>
          
          </td>
          
          <!-- BAND -->
          
        <td width="471" valign="top"> <table width="100%" bgcolor="#FFFFFF">
            <tr> 
              <td bgcolor="#0066CC" height="32"> <strong><img src="../../images/bandinfo.gif" width="150" height="24"></strong></td>
            </tr>
            <tr> 
              <td> <table width="100%" bgcolor="#FFFFFF">
                  <tr> 
                    <td width="39%" height="215"> <p><strong><font color="#0033CC" size="+3" face="Tahoma">Selkin 
                        </font></strong><font size="1" face="Tahoma"><strong><a href="http://www.selkin.com">[official 
                        site]</a> </strong></font> </p>
                      <table width="100%">
                        <tr> 
                          <td> <img src="../../images/divider.gif" width="100%" height="1"></td>
                        </tr>
                        <tr> 
                          <td> <font size="1" face="Tahoma">Matthew Howerton - Vocals/Guitar</font></td>
                        </tr>
                        <tr> 
                          <td> <font size="1" face="Tahoma">Kent Willis - Guitar</font></td>
                        </tr>
                        <tr> 
                          <td height="17"> <font size="1" face="Tahoma">J.Ross Massengill 
                            - Bass</font></td>
                        </tr>
                        <tr> 
                          <td> <font size="1" face="Tahoma">Keelan Willis - Drums</font></td>
                        </tr>
                      </table>
                      <p></p></td>
                    <td width="61%" align="center"><img src="../../images/bands/selkin.gif" width="279" height="228"></td>
                  </tr>
                </table>
                <!-- BAND DESCRIP -->
                <table width="100%" bgcolor="#FFFFFF">
                  <tr> 
                    <td width="93%"> <font size="2" face="Tahoma">Selkin is a four-piece 
                      band located in Ennis, Texas, specializing in alternative rock. 
                      With incredible devotion to their music, this band has been 
                      pumping out locally popular tunes and crowd-pleasers. Although 
                      they have only played a few small shows at parties, the fan 
                      reaction has been nothing but positive. Expect to hear more 
                      from these guys, and their album will be the first to test out 
                      the Garage.</font></td>
                  </tr>
                </table>
                
                
                
                    <!-- RATINGS -->
                  
                <table width="100%" bgcolor="#FFFFFF">
                  <tr> 
                    <td bgcolor="#0066CC" height="32"><img src="../../images/ratings.gif" width="150" height="24"></td>
                  </tr>
                </table>
                
      <!-- USER RATINGS -->
       <?PHP
       


    $bandid 
    '2samurai';


       if (
    $show == "showall") {
        
    $dbh=mysql_connect ("localhost""francis_rate""rate") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db ("francis_ratings");
    $sql "SELECT
    name,
    email,
    rating,
    comment
    FROM
    ratings
    WHERE
    bandid = 
    $bandid
    ORDER BY date DESC"
    ;
    $sql_result mysql_query($sql) or die ('Could not select data');


    }
      else {
        
    $dbh=mysql_connect ("localhost""francis_rate""rate") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db ("francis_ratings");
    $sql "SELECT
    name,
    email,
    rating,
    comment
    FROM
    ratings
    ORDER BY date DESC
    LIMIT 5"
    ;
    $sql_result mysql_query($sql) or die ('Could not select data');
    }

    while (
    $row mysql_fetch_row($sql_result))
    {
    $name$row[0];
    $email$row[1];
    $rating$row[2];
    $comment$row[3];
    $commentnl2br($comment);

    echo
    "<table width='100%' border='0' height='25' bgcolor='#FFFFFF' cellspacing='2'>";
    echo
    "<tr>";
    echo
    "<td height='5' align='left' width='100%' bgcolor='#EBEBEB'>";
    echo
    "<table width='100%' height='14'>";
    echo
    "<tr>";
    echo
    "<td height='14' align='left' width='100%' bgcolor='#EBEBEB'>";
    echo
    "<font face='Tahoma' size='2' color='#000000'><a href='mailto:$email'>$name</a></font></td>";


    if (
    $rating == '1') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    if (
    $rating == '2') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    if (
    $rating == '3') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    if (
    $rating == '4') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    if (
    $rating == '5') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    echo
    "</font></td>";
    echo
    "</tr>";
    echo
    "</table>";
    echo
    "</td>";
    echo
    "</tr>";
    echo
    "<tr>";
    echo
    "<td align='left' valign='top' height='11' width='78%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>$comment</font></td>";
    echo
    "</tr>";
    echo
    "</table>";
    echo
    "<table width='100%'>";
    echo
    "<tr>";
    echo
    "<td>";
    echo
    "<img src='../../images/divider.gif' width='100%' height='2'>";
    echo
    "</td>";
    echo
    "</tr>";
    echo
    "</table>";
    }

    mysql_close($dbh);
    ?>
            <!-- AVG RATING-->
            <?
            $numrows 
    mysql_num_rows($sql_result);
    $ratingtotal=0
    $ratingtotal$ratingtotal $rating
    $averating$ratingtotal/$numrows
    $averating number_format($averating1'.'''); 


       echo 
    "<table width='100%' bgcolor='#EBEBEB'>";
    echo 
    "<tr>";
    echo 
    "<td width='100%'>";
    echo 
    "<strong><font size='1' face='Tahoma'>Average rating is $averating/5</font></strong>";
    echo 
    "</td>";
    echo 
    "</tr>";
    echo 
    "</table>";
    ?>
            <!--SHOWALL-->
                    <table width="100%" bgcolor="#EBEBEB">
            <tr>
        <td bgcolor="#EBEBEB" align="center"> <a href="?show=showall"><strong><font size="1" face="Tahoma">Show 
          all ratings</font></strong></a> </td>
        </tr>

        </table>
                  <!--RATE-->
            <table width="100%" bgcolor="#EBEBEB">
            <tr>
        <td bgcolor="#EBEBEB"> <font size="2" face="Tahoma"><strong>Submit a Rating: </strong></font> 
        </td>
      </tr>

                  <tr> 
                    
        <td height="241" bgcolor="#EBEBEB"> 
          <form name="rate" method="post" action="../../rateprocess.php">
                        <table width="100%" border="0" height="192">
                          <tr> 
                            <td height="5"><div align="right"><font color="#000000" size="2" face="Tahoma">Name:</font></div></td>
                            <td height="5" align="left" valign="top"><input type="text" name="name" size="30"></td>
                          </tr>
                      <tr> 
                            <td height="5"><div align="right"><font color="#000000" size="2" face="Tahoma">Email:</font></div></td>
                            <td height="5" align="left" valign="top"><input type="text" name="email" size="30"></td>
                          </tr>
                              <tr> 
                            <td height="9"><div align="right"><font color="#000000" size="2" face="Tahoma">Rate:</font></div></td>
                            <td height="9" align="left" valign="top">
                            <strong><font size="2" face="Tahoma">1</font></strong><INPUT TYPE="radio" NAME="rating" value="1">
                            
                            <strong><font size="2" face="Tahoma">2</font></strong><INPUT TYPE="radio" NAME="rating" value="2">
                            
                            <strong><font size="2" face="Tahoma">3</font></strong><INPUT TYPE="radio" NAME="rating" value="3">
                            
                            <strong><font size="2" face="Tahoma">4</font></strong><INPUT TYPE="radio" NAME="rating" value="4">
                            
                            <strong><font size="2" face="Tahoma">5</font></strong><INPUT TYPE="radio" NAME="rating" value="5">
                              </td>
                          </tr>
                          <tr> 
                            <td height="136" valign="top"> 
                              <div align="right"><font color="#000000" size="2" face="Tahoma">Comments:</font></div></td>
                            <td align="left" valign="top" height="136"> 
                              <div align="left"> 
                    <textarea name="comment" cols="50" rows="7"></textarea>
                  </div></td>
                          </tr>
                        </table>
                <INPUT TYPE="hidden" NAME="id" value="<? echo '$bandid' ?>">
    <input type="submit" name="Submit" value="Submit">
    </form>
                    
                    </td>
                  </tr>
         
                </table>
                
                
                <!-- CLOSE CENTER -->
              </td>
            </tr>
          </table></td>
          
        <td width="162" valign="top" bgcolor="#FFFFFF"> 
          <!-- BAND NEWS -->
          <table width="100%" border="0" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
            <tr> 
              <td height="32" bgcolor="#0066CC" width="211"><img src="../../images/bandnews.gif"></td>
            </tr>
            <!-- BAND NEWS DATE/TITLE -->
            <tr> 
              <td bgcolor="#E9E9E9"> <font size="2" face="Tahoma"><strong>Selkin:</strong></font></td>
            </tr>
    </table>
    <table width="100%" border="0" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
            <tr>
              <td bgcolor="#E9E9E9"> <font size="1" face="Tahoma"><strong>November 
                25, 2003</strong></font></td>
            </tr>
            <tr>
            
            
              <td height="30" bgcolor="#E9E9E9"> 
                <p><font size="2" face="Tahoma">- Selkin has just written a new song, 
                  called &quot;In My Eyes&quot; See the lyrics at their site.</font></p>
                </td>
            </tr>

            </table>

            <table width="100%" border="0" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
            <tr>
              <td bgcolor="#E9E9E9"> <font size="1" face="Tahoma"><strong>October 23, 2003</strong></font></td>
            </tr>
            <tr>
            
            
              <td height="30" bgcolor="#E9E9E9"> 
                <p><font size="2" face="Tahoma">- Selkin is planning to release 
                  their first album between 2003 and 2004!</font></p>
                </td>
            </tr>
            <tr>
              <td bgcolor="#E9E9E9"> <font size="2" face="Tahoma">- Selkin has two 
                mp3's available for free download at their site.</font> </td>
            </tr>
            </table>
            
            <!-- SHOWS -->

      <table width="100%">
      <tr>
      <td bgcolor="#0066CC">
      
      <img src="../../images/shows.gif">
      
      </td>
      </tr>
      
              <tr>
              <td bgcolor="#E9E9E9"> <font size="1" face="Tahoma"><strong>none scheduled</strong></font></td>
            </tr>
            <tr>
            
            
              <td height="30" bgcolor="#E9E9E9"> 
                <p><font size="2" face="Tahoma">none scheduled</font></p>
                </td>
            </tr>
      
      </table>
            
            
          <!-- FILLER AD -->
          <table width="100%"> 
            <tr> 
              <td bgcolor="#E9E9E9" width="100%"> <font size="1" face="Tahoma">ADVERTISEMENT:</font> </td>
            </tr>
              <td height="100" valign="middle"> <img src="../../ads/sk8.gif" width="153" height="100"> 
              </td>
            </tr>
          </table>
          <table width="100%" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
            <tr>
              <td align="center" bgcolor="#E9E9E9"> <font size="2" face="Tahoma"><strong>SK8 THE MOVIE</strong></font> 
              </td>
            </tr>
            <tr>
              <td align="center" bgcolor="#E9E9E9"> <a href="http://www.geocities.com/sk8movie/Artic/sk8orderform.html"><strong><font size="3" face="Tahoma">ORDER 
                IT TODAY</font></strong></a> </td>
            </tr>
          </table>
          <!-- CONTENT END -->
        </td>
      </tr>

          </table>
          
    <!-- COPYRIGHT -->
    <table width="800" cellspacing="0" cellpadding="0" align="center">
    <tr><td width="100%">
    <img src="../../images/copyright.gif" width="800">

    </td></tr></table>

    </body>
    </html>

  13. #38
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just reduce the size of the table width, and more importantly the col width of the comment form text box. thats whats throwing it off.

    As for the off rating, I cant see why thats occuring. has it always done this? it would be easier if you could tell me when it was working, and what changes your implemented which caused it to go wrong.

  14. #39
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats how it was working originally...i have no idea what is wrong with it. im going to fix the comment box width, thanks for that.

    ill look more into the averages

  15. #40
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but ive run into ANOTHER problem:

    rateprocess.php

    PHP Code:

    <?PHP

    if {$bandid '2samurai') {
    setcookie("2samurai"'2samurai');
    }

    elseif {
    $bandid 'selkin') {
    setcookie("selkin"'selkin');
    }


    ?>

    <html>
    <head>
    <title>RATE PROCESS</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    </head>

    <body bgcolor="#FFFFFF" text="#000000" link="#666666">
    <?PHP





    if ($bandid '2samurai') {

    if( isset(
    $_COOKIE['2samurai']) ) {

    echo (
    "Sorry, you have already rated.<BR><BR>");

    }

    elseif (
    $bandid 'selkin') {

    if( isset(
    $_COOKIE['selkin']) ) {

    echo (
    "Sorry, you have already rated.<BR><BR>");

    }

    } elseif (empty(
    $name) || empty($email) || empty($rating) || empty($comment)) {

       

       echo 
    "<font face='Tahoma' size='2'>Please fill in all necessary forms.</font><BR><BR>";

       } else {
       
       if (
    $bandid '2samurai') {
    echo 
    "<META HTTP-EQUIV='refresh' CONTENT='0; URL='bands/twosamurai/index.php'>";
    }

       elseif (
    $bandid 'selkin') {
    echo 
    "<META HTTP-EQUIV='refresh' CONTENT='0; URL='bands/selkin/index.php'>";
    }



           
    $dbh=mysql_connect ("localhost""francis_rate""rate") or die ('I cannot connect to the database because: ' mysql_error());
       
    mysql_select_db ("francis_ratings");
       
    $bandid=$_POST['bandid'];
       
    $sql "INSERT INTO ratings
    (
    name,
    email,
    rating,
    comment,
    bandid
    ) VALUES
    (
    '
    $name',
    '
    $email',
    '
    $rating',
    '
    $comment',
    '
    $bandid'
    )"
    ;
    $sql_result mysql_query($sql,$dbh) or die ('Could not insert data.');
    mysql_close($dbh);



    echo 
    "<font face='Tahoma' size='2'>Thank you for your rating.</font><BR><BR>";

    }

    ?>
    <A HREF="javascript:history.go(-1)"> <font size="2" face="Tahoma">Back</font></A>
    </body>
    </html>

    the problem is:

    i want to create individual cookies for each band's rating. I realized when I did one cookie for all of them, someone can only vote for one band and not fora ny others. since I dont have the IDs working properly, I can't get this working correctly. so how do I fix it so that each band's rating has their individual cookies, and how do I fix it so the ids work properly?

    the ids arent working because I can post a rating on one band's rating, and it will appear on another band's rating as well.

    you can try it out yourself.

    currently the only two pages with the ratings are:

    http://garage.noammo.org/bands/selkin

    http://garage.noammo.org/bands/twosamurai

  16. #41
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It wouldnt let me rate.

    Also you really should of thought of this first.

    What I would do, is for each band page, have an automatically assigned id to each page. I.e. the selkin page has the id 25.

    Then, when you set the cookie, you set the cookie the value 25, or whatever value of the band they have just rated. You would have to put the ids either into the database or pass them in the query string.

    Then when you check for the cookie, you dont check for the COOKIE, you check for the value of THAT band within the 1 cookie. you dont want to be creating 10 cookies if you they rate 10 bands for example.

    really you should try and give each band an id and use this..i dont see what problem this could cause you, if a little bit of pain in the posterior.

    Also I dont understand your database schema so can;t get a clear idea of how its working.

  17. #42
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ive been trying to work with IDs and i have been unsuccessful with them. I'm going to keep trying though.

    yea i definitely should have thought this through.

    ok if you notice I have bandids for the bands.

    could I simply do this:

    PHP Code:
    <?PHP

    if {$bandid '4') {
    setcookie("alreadyrated"'4');
    }

    elseif {
    $bandid '1') {
    setcookie("alreadyrated"'1');
    }


    ?>

    at the top?

    or would it be something like this:

    PHP Code:
    <?PHP

    setcookie
    ("alreadyrated"'$bandid');

    ?>
    also if you know any places with tutorials for this it would be helpful. all i get on google are tutorials for advanced IDS.

    what did it say when it didnt let you rate?

  18. #43
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Didnt log the error.

    You are on the right tracks with the first snippet, although you want to say if there is a cookie called already rated && it contains the value 4 tell them theyve already rated.

  19. #44
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i forgot to add, my database is set up like this:

    there is a table called "ratings"

    here are the fields, types, and lengths/values

    date timestamp(14)

    name char(20)

    email char(100)

    rating char(10)

    comment char(255)

    id char(100)


    hope that helped.

  20. #45
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so like this?

    PHP Code:
    <?PHP

    if {$bandid '4') {
    setcookie("alreadyrated"'4');
    }

    elseif {
    $bandid '1') {
    setcookie("alreadyrated"'1');
    }


    if (isset (
    $_COOKIE['alreadyrated, 4']) {

    echo 
    "You have already rated"

    }

    elseif (isset (
    $_COOKIE['alreadyrated, 1']) {

    echo 
    "You have already rated"

    }

    else {

    continue 
    on with the processing.


    ?>

  21. #46
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    aw crud. the ids arent working at all....here's the coding for a couple of the pages:

    selkin.php
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>the garage | bands.selkin</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    <STYLE type=text/css>
    A:link {
        COLOR: #666666
    }
    A:visited {
        COLOR: #666666
    }
    A:hover {
        COLOR: #cccccc
    }
    </STYLE>



    </head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="description" content="The Garage is a network designed to give bands exposure and distribution among network points, as well as cheap studio fees for all Garage studios.">
    </head>

    <BODY BGCOLOR=#006699 text="#000000" link="#666666" vlink="#666666" alink="#666666" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
    <!-- HEADER -->
    <table width="800" cellspacing="0" cellpadding="0" align="center">
    <tbody>

        <tr> 
     
          <td width="800" height="141" valign="top"> <img src="../../images/thegarage.gif" alt="the garage" width="800" height="140">
          <img src="../../images/divider.gif" width="100%" height="1"></td>
      </tr>
      
      <!-- NAVIGATION -->
      <tr>
          <td bgcolor="#0066CC" height="44"> 
            <table width="798">
                <td width="61" height="38" bgcolor="#0066CC"><a href="../../index.php"
    onMouseOver="document.news.src='../../images/nav_newson.gif';" onMouseOut="document.news.src='../../images/nav_news.gif';"> 
                  <img src="../../images/nav_news.gif" width="60" height="24" name="news" border="0"></a> 
                </td>
                <td width="76" height="38" bgcolor="#0066CC"><a href="../../about" 
    onMouseOver="document.about.src='../../images/nav_abouton.gif';" onMouseOut="document.about.src='../../images/nav_about.gif';"> 
                  <img src="../../images/nav_about.gif" height="24" name="about" border="0"></a> 
                </td>
                <td width="76" height="38" bgcolor="#0066CC"><a href="../../store" 
    onMouseOver="document.store.src='../../images/nav_storeon.gif';" onMouseOut="document.store.src='../../images/nav_store.gif';"> 
                  <img src="../../images/nav_store.gif" name="store" border="0"></a> </td>
                <td width="71" height="38" bgcolor="#0066CC"><a href="../../media" 
    onMouseOver="document.media.src='../../images/nav_mediaon.gif';" onMouseOut="document.media.src='../../images/nav_media.gif';"> 
                  <img src="../../images/nav_media.gif" name="media" border="0"></a> </td>
                <td width="76" height="38" bgcolor="#0066CC"><a href="../../shows" 
    onMouseOver="document.shows.src='../../images/nav_showson.gif';" onMouseOut="document.shows.src='../../images/nav_shows.gif';"> 
                  <img src="../../images/nav_shows.gif" name="shows" border="0"></a> </td>
                <td width="102" height="38" bgcolor="#0066CC"> <a href="../../contact" 
    onMouseOver="document.contact.src='../../images/nav_contacton.gif';" onMouseOut="document.contact.src='../../images/nav_contact.gif';"> 
                  <img src="../../images/nav_contact.gif" name="contact" border="0"></a> 
                </td>
                <td width="66" height="38" bgcolor="#0066CC"> <a href="../../links" 
    onMouseOver="document.links.src='../../images/nav_linkson.gif';" onMouseOut="document.links.src='../../images/nav_links.gif';"> 
                  <img src="../../images/nav_links.gif" name="links" border="0"></a> </td>
      <td width="162">
      
        <!-- BANDS -->
        <table width="162" border="0" cellpadding="4" cellspacing="2" bgcolor="#0066CC">
        <tr>
            <FORM name=bandselecta action=# method=post>
        <TD width="150" align=left><SELECT style="WIDTH: 150px" 
          onchange=location.href=options[selectedIndex].value; name=iBandId> 
            <OPTION selected>Bands</OPTION> 
        
            <OPTION 
            value=http://garage.noammo.org/bands/noammo>No Ammo</OPTION>

            <OPTION 
            value=http://garage.noammo.org/bands/selkin>Selkin</OPTION>
                <OPTION 
            value=http://garage.noammo.org/bands/superdelightful>Super Delightful</OPTION>
            
                        <OPTION 
            value=http://garage.noammo.org/bands/twosamurai>The Two Samurai</OPTION>
            </SELECT>
            </TD></FORM>
            </tr>
            </table></td>
                <td width="68" height="38" bgcolor="#0066CC">&nbsp; </td>
      </tr>
      </table>
      
      
      </td>
      </tr>
      </table>
      
      
    <!-- CONTENT -->
    <table width="800" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF" height="700">
     
        <td width="165" height="268" bgcolor="#FFFFFF" valign="top"> 
          <!-- RELEASES -->
          <table width="140" border="0" cellpadding="4" cellspacing="2">
                  <tr> 
              <td height="32" bgcolor="#0066CC" width="150"><img src="../../images/releases.gif"></td>
            </tr>
            <!-- RELEASES INFO -->
            <tr>
              <td height="100%" bgcolor="#E9E9E9"> 
                <table width="100%">
      <tr>
                    <td width="100%" align="center"> <img src="../../images/albums/keeponplayin.gif" width="121" height="114"></td>
                  </tr>
    </table>
                  <table>
                     <tr>
                    <td><img src="../../images/divider.gif" width="100%" height="1"></td>
                  </tr>
                  <tr>
                   
        <td width="92%"><p><font size="1" face="Verdana, Arial, Helvetica, sans-serif, Alpha Romanie Outline G98, Alpha Sentry, Volt"><strong>Selkin - Keep On Playin'</strong></font></p>
                      <p><font face="Arial, Arial Black, Arial Narrow"><strong><font size="1">-</font></strong><font size="1">The 
                        first album from the alt. rock band from Ennis, Texas. From 
                        local fan reactions, this band's album will defintely be worth 
                        getting. </font></font></p></td>
      </tr>
       <tr>
                    <td><img src="../../images/divider.gif" width="100%" height="1"></td>
                  </tr>
      <tr>
      
                    <td> <font size="1" face="Verdana, Arial, Helvetica, sans-serif, Alpha Romanie Outline G98, Alpha Sentry, Volt"><strong>Track 
                      Listing: </strong></font> </td>
                  </tr>
                     <tr>
                    <td><img src="../../images/divider.gif" width="100%" height="1"></td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">1. Hideaway </font> </td>
                  </tr>
                  <tr>
                    <td> <font size="1" face="Tahoma">2. Believe </font> </td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">3. Keep On Playin'</font></td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">4. Age of End</font></td>
                  </tr>
                  <tr>
                     <td><font size="1" face="Tahoma">5. In My Eyes </font> </td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">6. Layin' Low</font></td>
                  </tr>
                  <tr>
                    <td><font size="1" face="Tahoma">7. As One</font></td>
                  </tr>
                   <tr>
                    <td><font size="1" face="Tahoma">8. Memory</font></td>
                  </tr>
                   <tr>
                    <td><font size="1" face="Tahoma">9. Along the Way</font></td>
                  </tr>
                  
                  </table>
              </td>
            </tr>
          </table>
          
          <!-- OTHER RELEASES -->
      <table width="140" border="0" cellpadding="4" cellspacing="2">
                  <tr> 
              <td height="32" bgcolor="#0066CC" width="150"><img src="../../images/otherreleases.gif" width="150" height="24"></td>
            </tr>
            <!-- OTHER RELEASES INFO -->
            <tr>
              <td height="100%" bgcolor="#E9E9E9"> 
                <table width="100%">
     
                   <tr>
                    <td><font size="1" face="Tahoma">no other releases</font></td>
                  </tr>
                  
                  </table>
              </td>
            </tr>
          </table>
          
          </td>
          
          <!-- BAND -->
          
        <td width="471" valign="top"> <table width="100%" bgcolor="#FFFFFF">
            <tr> 
              <td bgcolor="#0066CC" height="32"> <strong><img src="../../images/bandinfo.gif" width="150" height="24"></strong></td>
            </tr>
            <tr> 
              <td> <table width="100%" bgcolor="#FFFFFF">
                  <tr> 
                    <td width="39%" height="215"> <p><strong><font color="#0033CC" size="+3" face="Tahoma">Selkin 
                        </font></strong><font size="1" face="Tahoma"><strong><a href="http://www.selkin.com">[official 
                        site]</a> </strong></font> </p>
                      <table width="100%">
                        <tr> 
                          <td> <img src="../../images/divider.gif" width="100%" height="1"></td>
                        </tr>
                        <tr> 
                          <td> <font size="1" face="Tahoma">Matthew Howerton - Vocals/Guitar</font></td>
                        </tr>
                        <tr> 
                          <td> <font size="1" face="Tahoma">Kent Willis - Guitar</font></td>
                        </tr>
                        <tr> 
                          <td height="17"> <font size="1" face="Tahoma">J.Ross Massengill 
                            - Bass</font></td>
                        </tr>
                        <tr> 
                          <td> <font size="1" face="Tahoma">Keelan Willis - Drums</font></td>
                        </tr>
                      </table>
                      <p></p></td>
                    <td width="61%" align="center"><img src="../../images/bands/selkin.gif" width="279" height="228"></td>
                  </tr>
                </table>
                <!-- BAND DESCRIP -->
                <table width="100%" bgcolor="#FFFFFF">
                  <tr> 
                    <td width="93%"> <font size="2" face="Tahoma">Selkin is a four-piece 
                      band located in Ennis, Texas, specializing in alternative rock. 
                      With incredible devotion to their music, this band has been 
                      pumping out locally popular tunes and crowd-pleasers. Although 
                      they have only played a few small shows at parties, the fan 
                      reaction has been nothing but positive. Expect to hear more 
                      from these guys, and their album will be the first to test out 
                      the Garage.</font></td>
                  </tr>
                </table>
                
                
                
                    <!-- RATINGS -->
                  
                <table width="100%" bgcolor="#FFFFFF">
                  <tr> 
                    <td bgcolor="#0066CC" height="32"><img src="../../images/ratings.gif" width="150" height="24"></td>
                  </tr>
                </table>
                
                
          <!-- USER RATINGS -->
       <?PHP
       


    $id 
    '1';


       if (
    $show == "showall") {
        
    $dbh=mysql_connect ("localhost""francis_rate""rate") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db ("francis_ratings");
    $sql "SELECT
    name,
    email,
    rating,
    comment
    FROM
    ratings
    WHERE
    id = 
    $id
    ORDER BY date DESC"
    ;
    $sql_result mysql_query($sql) or die ('Could not select data');


    }
      else {
        
    $dbh=mysql_connect ("localhost""francis_rate""rate") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db ("francis_ratings");
    $sql "SELECT
    name,
    email,
    rating,
    comment
    FROM
    ratings
    WHERE
    id = 
    $id
    ORDER BY date DESC
    LIMIT 5"
    ;
    $sql_result mysql_query($sql) or die ('Could not select data');
    }

    while (
    $row mysql_fetch_row($sql_result))
    {
    $name$row[0];
    $email$row[1];
    $rating$row[2];
    $comment$row[3];
    $commentnl2br($comment);

    echo
    "<table width='100%' border='0' height='25' bgcolor='#FFFFFF' cellspacing='2'>";
    echo
    "<tr>";
    echo
    "<td height='5' align='left' width='100%' bgcolor='#EBEBEB'>";
    echo
    "<table width='100%' height='14'>";
    echo
    "<tr>";
    echo
    "<td height='14' align='left' width='100%' bgcolor='#EBEBEB'>";
    echo
    "<font face='Tahoma' size='2' color='#000000'><a href='mailto:$email'>$name</a></font></td>";


    if (
    $rating == '1') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    if (
    $rating == '2') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    if (
    $rating == '3') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    if (
    $rating == '4') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    if (
    $rating == '5') {

    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";
    echo
    "<td align='left' valign='top' height='14' width='25%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>";
    echo 
    "<img src='../../images/star.gif'>";
    echo
    "</td>";

    }

    echo
    "</font></td>";
    echo
    "</tr>";
    echo
    "</table>";
    echo
    "</td>";
    echo
    "</tr>";
    echo
    "<tr>";
    echo
    "<td align='left' valign='top' height='11' width='78%' bgcolor='#EBEBEB'><font face='Tahoma' size='2' color='#000000'>$comment</font></td>";
    echo
    "</tr>";
    echo
    "</table>";
    echo
    "<table width='100%'>";
    echo
    "<tr>";
    echo
    "<td>";
    echo
    "<img src='../../images/divider.gif' width='100%' height='2'>";
    echo
    "</td>";
    echo
    "</tr>";
    echo
    "</table>";
    }

    mysql_close($dbh);
    ?>
            <!-- AVG RATING-->
            <?
            $numrows 
    mysql_num_rows($sql_result);
    $ratingtotal=0
    $ratingtotal$ratingtotal $rating
    $averating$ratingtotal/$numrows
    $averating number_format($averating1'.'''); 


       echo 
    "<table width='100%' bgcolor='#EBEBEB'>";
    echo 
    "<tr>";
    echo 
    "<td width='100%'>";
    echo 
    "<strong><font size='1' face='Tahoma'>Average rating is $averating/5</font></strong>";
    echo 
    "</td>";
    echo 
    "</tr>";
    echo 
    "</table>";
    ?>
            <!--SHOWALL-->
                    <table width="100%" bgcolor="#EBEBEB">
            <tr>
        <td bgcolor="#EBEBEB" align="center"> <a href="?show=showall"><strong><font size="1" face="Tahoma">Show 
          all ratings</font></strong></a> </td>
        </tr>

        </table>
                  <!--RATE-->
            <table width="100%" bgcolor="#EBEBEB">
            <tr>
        <td bgcolor="#EBEBEB"> <font size="2" face="Tahoma"><strong>Submit a Rating: </strong></font> 
        </td>
      </tr>

                  <tr> 
                    
        <td height="241" bgcolor="#EBEBEB"> 
        
        
          <form name="rate" method="post" action="../../rateprocess.php">
                        <table width="100%" border="0" height="192">
                          <tr> 
                            <td height="5"><div align="right"><font color="#000000" size="2" face="Tahoma">Name:</font></div></td>
                            <td height="5" align="left" valign="top"><input type="text" name="name" size="30"></td>
                          </tr>
                      <tr> 
                            <td height="5"><div align="right"><font color="#000000" size="2" face="Tahoma">Email:</font></div></td>
                            <td height="5" align="left" valign="top"><input type="text" name="email" size="30"></td>
                          </tr>
                              <tr> 
                            <td height="9"><div align="right"><font color="#000000" size="2" face="Tahoma">Rate:</font></div></td>
                            <td height="9" align="left" valign="top">
                            <strong><font size="2" face="Tahoma">1</font></strong><INPUT TYPE="radio" NAME="rating" value="1">
                            
                            <strong><font size="2" face="Tahoma">2</font></strong><INPUT TYPE="radio" NAME="rating" value="2">
                            
                            <strong><font size="2" face="Tahoma">3</font></strong><INPUT TYPE="radio" NAME="rating" value="3">
                            
                            <strong><font size="2" face="Tahoma">4</font></strong><INPUT TYPE="radio" NAME="rating" value="4">
                            
                            <strong><font size="2" face="Tahoma">5</font></strong><INPUT TYPE="radio" NAME="rating" value="5">
                              </td>
                          </tr>
                          <tr> 
                            <td height="136" valign="top"> 
                              <div align="right"><font color="#000000" size="2" face="Tahoma">Comments:</font></div></td>
                            <td align="left" valign="top" height="136"> 
                              <div align="left"> 
                    <textarea name="comment" cols="40" rows="7"></textarea>
                  </div></td>
                          </tr>
                        </table>
                <INPUT TYPE="hidden" NAME="id" value="<? echo '$id'?>">
    <input type="submit" name="Submit" value="Submit">
    </form>
                    
                    </td>
                  </tr>
         
                </table>
                
                
                <!-- CLOSE CENTER -->
              </td>
            </tr>
          </table></td>
          
        <td width="162" valign="top" bgcolor="#FFFFFF"> 
          <!-- BAND NEWS -->
          <table width="100%" border="0" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
            <tr> 
              <td height="32" bgcolor="#0066CC" width="211"><img src="../../images/bandnews.gif"></td>
            </tr>
            <!-- BAND NEWS DATE/TITLE -->
            <tr> 
              <td bgcolor="#E9E9E9"> <font size="2" face="Tahoma"><strong>Selkin:</strong></font></td>
            </tr>
    </table>
    <table width="100%" border="0" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
            <tr>
              <td bgcolor="#E9E9E9"> <font size="1" face="Tahoma"><strong>November 
                25, 2003</strong></font></td>
            </tr>
            <tr>
            
            
              <td height="30" bgcolor="#E9E9E9"> 
                <p><font size="2" face="Tahoma">- Selkin has just written a new song, 
                  called &quot;In My Eyes&quot; See the lyrics at their site.</font></p>
                </td>
            </tr>

            </table>

            <table width="100%" border="0" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
            <tr>
              <td bgcolor="#E9E9E9"> <font size="1" face="Tahoma"><strong>October 23, 2003</strong></font></td>
            </tr>
            <tr>
            
            
              <td height="30" bgcolor="#E9E9E9"> 
                <p><font size="2" face="Tahoma">- Selkin is planning to release 
                  their first album between 2003 and 2004!</font></p>
                </td>
            </tr>
            <tr>
              <td bgcolor="#E9E9E9"> <font size="2" face="Tahoma">- Selkin has two 
                mp3's available for free download at their site.</font> </td>
            </tr>
            </table>
            
            <!-- SHOWS -->

      <table width="100%">
      <tr>
      <td bgcolor="#0066CC">
      
      <img src="../../images/shows.gif">
      
      </td>
      </tr>
      
              <tr>
              <td bgcolor="#E9E9E9"> <font size="1" face="Tahoma"><strong>none scheduled</strong></font></td>
            </tr>
            <tr>
            
            
              <td height="30" bgcolor="#E9E9E9"> 
                <p><font size="2" face="Tahoma">none scheduled</font></p>
                </td>
            </tr>
      
      </table>
            
            
          <!-- FILLER AD -->
          <table width="100%"> 
            <tr> 
              <td bgcolor="#E9E9E9" width="100%"> <font size="1" face="Tahoma">ADVERTISEMENT:</font> </td>
            </tr>
              <td height="100" valign="middle"> <img src="../../ads/sk8.gif" width="153" height="100"> 
              </td>
            </tr>
          </table>
          <table width="100%" cellpadding="4" cellspacing="2" bgcolor="#FFFFFF">
            <tr>
              <td align="center" bgcolor="#E9E9E9"> <font size="2" face="Tahoma"><strong>SK8 THE MOVIE</strong></font> 
              </td>
            </tr>
            <tr>
              <td align="center" bgcolor="#E9E9E9"> <a href="http://www.geocities.com/sk8movie/Artic/sk8orderform.html"><strong><font size="3" face="Tahoma">ORDER 
                IT TODAY</font></strong></a> </td>
            </tr>
          </table>
          <!-- CONTENT END -->
        </td>
      </tr>

          </table>
          
    <!-- COPYRIGHT -->
    <table width="800" cellspacing="0" cellpadding="0" align="center">
    <tr><td width="100%">
    <img src="../../images/copyright.gif" width="800">

    </td></tr></table>

    </body>
    </html>
    and rateprocess.php

    PHP Code:

    <?PHP

    if ($id '4') {
     
    setcookie("alreadyrated"'$4'); 
     }

    elseif (
    $id '1') {
     
    setcookie("alreadyrated"'$1'); 
     }


    ?>

    <html>
    <head>
    <title>RATE PROCESS</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    </head>

    <body bgcolor="#FFFFFF" text="#000000" link="#666666">
    <?PHP




     
    if ($id '1') {

    if( isset(
    $_COOKIE['$1']) ) {

    echo (
    "Sorry, you have already rated.<BR><BR>");

    } }

    elseif (
    $id '4') {

    if( isset(
    $_COOKIE['$4']) ) {

    echo (
    "Sorry, you have already rated.<BR><BR>");



    } elseif (empty(
    $name) || empty($email) || empty($rating) || empty($comment)) {

         

        echo 
    "<font face='Tahoma' size='2'>Please fill in all necessary forms.</font><BR><BR>";

        } else { 
        




            
    $dbh=mysql_connect ("localhost""francis_rate""rate") or die ('I cannot connect to the database because: ' mysql_error());
        
    mysql_select_db ("francis_ratings");
        
    $id=$_POST['id'];
        
    $sql "INSERT INTO ratings
    (
    name,
    email,
    rating,
    comment,
    id
    ) VALUES
    (
    '
    $name',
    '
    $email',
    '
    $rating',
    '
    $comment',
    '
    $id'
    )"
    ;
    $sql_result mysql_query($sql,$dbh) or die ('Could not insert data.');
    mysql_close($dbh);



    echo 
    "<font face='Tahoma' size='2'>Thank you for your rating.</font><BR><BR>";

    }

    ?>
    <A HREF="javascript:history.go(-1)"> <font size="2" face="Tahoma">Back</font></A> 
    </body>
    </html>

    its getting so frustrating...

    after the attempt to add cookies and use ids, a few parts of the pages arent working properly. i figfured if I got the ids and cookies to work properly, then whats not working will be fixed, or it will be easier to fix them.

  22. #47
    Non-Member
    Join Date
    Nov 2003
    Location
    here
    Posts
    258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So whats going wrong - what error messages are you getting, whats failing? Its hard to tell from just looking at a big page of code.

  23. #48
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    right now im going to forget about all of the cookie/session stuff and try to get these ids to function. I'm going to revamp some of my site to see if it will help. when i finish that I will explain.


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
  •