Jump to content

Alexhoward

Members
  • Posts

    310
  • Joined

  • Last visited

    Never

Posts posted by Alexhoward

  1. Hi,

     

    There's plenty of rating scripts out there.

     

    have a look at google,

     

    some are really compicated, some not (but are not very good either)

     

    (I'm also stuggling with rating scripts at the moment, so i know where you're coming from)

     

    Basically when a rating is displayed on a page, it's tied to an ID,

     

    So in your case (if you don't store your pictures with an ID) it would be the name of the pic or whatever unique identifier you're using to pull them onto the page in the 1st palce

     

    i kind of know how they'll work, but i can't do it either!!!

  2. Hi guys,

     

    Loving this site,

     

    as a newbie, who doesn't know what he's really doing, i'm made some pretty good progress.

     

    Mainly down to you lot! and a bit of google :D

     

    So what would i like to do?

     

    1) members rate there links (pulled from whatever they've chosen from the main page) using a 5/10 star rating system

     

    2) the content on the main page then displays the average of the users votes under each link.

     

     

    some main points:

     

    1.  I want the members to be able to change their rating, and just display their vote on their page.

     

    (incase they really like the link, then one day it all goes wrong, and they hate it)

     

    2.  on the main page to display the average of all the votes under each link, as a static vote

     

    3.  Only members can vote (from their page)

     

    Does this make sense...?

     

    Thanks in advance

     

     

     

     

     

     

  3. .....

     

    i don't really understand what you're asking?

     

    is that you want a page of links.

     

    then when you click on one of the links it sends you to another page with the page header as the link name..?

     

    do you need to use PHP and a database for this...?

     

    what do you mean "some info" ?

  4. Can i just do it as a style thou,

     

    as it's not really a table, not a static one anyway,

     

    it's being made due to the amount of links

     

    <?php
    }
    
    
    $mysite_username = $_COOKIE["mysite_username"];
    
    $conn = mysql_connect($server, $db_user, $db_pass)
    or die ("could not connect to mysql");  #Connect to mysql
    $rs = mysql_select_db( $database, $conn )
    or die ("Could not select database"); #select database 
    
    $sql = "Select link FROM links";  //pull the users from the table
    
    $result= mysql_query($sql)
    or die(" Could not add style facts");
    
    echo "<table align=center border=1>";        // display the users in table
    $c = 0;
    while($row = mysql_fetch_array($result)) { 
       $user2 = htmlspecialchars($row['link'],  ENT_QUOTES);
       $user3 = $row['link'];
       //$user2 = $row['link'];
      if($c%5 == 0) echo "<tr height=\"200px\">"; // If the counter has ticked 6 times, start a new row.
    
    
    
    $sql2 = "SELECT link FROM memberlinks WHERE username = '$mysite_username' and link = '$user2'";
    
    $result2 = mysql_query($sql2) or die(" Could not add style facts");
    
    //$qry2 = mysql_query($result2) 
    //or die ("Could not match data because ".mysql_error()); 
    
    $num_rows = mysql_num_rows($result2); 
    
    if ($num_rows != 0) { 
    
    //if(empty($result2))
    //{
    $button = "Link Added";
    }else{
    $button = "<input type='submit' value='Add Link'>";
    }
    
    //<input type=submit>
    
    //UPDATEED: removed the action (action='addlinks.php') as we call ourself
    echo "<td><FORM method='post'><p><input type=HIDDEN name='user' value='$mysite_username'></p><p align=center><input type=HIDDEN name='user2' value='$user2'></p><p align=center>$user3</p><p align=center>rating script here</p><p align=center>$button</p></form>";
    
      if($c%5 == 4) echo "</tr>"; // If we're drawing the 5th pic, end this row.
      $c++;
    }
    if($c%5 != 4) echo "</tr>"; // If there isn't a number of pics divisible by 6, end the row
    echo "</table>"; // end the table
    
    
    ?>
    

     

    know this has got difficult to look at

  5. Yea it works a treat!

     

    when i get home tonight i'll put it all on the correct pages, and link them up properly.

     

    i'm at work at the moment, and doing this through my servers online ftp, and editor.

     

    working with txt is rubbish (no nice colours :))

     

    I feel rude to keep asking you questions,

     

    but this is the last one for this section

     

    promise.

     

    the script that arranges them in the grid, puts them all next to each other, and i'd like to spread them out a bit.

     

    and draw a box aroung them withrounded corners (obviously i'll get rid of the table border, and i take it that this will be a graphic i'll have to insert)

     

    I've tried messing with the usual table funtions but can't get it how i'd like.

     

    basically the grid will be 4 x 3, or 3 x 3 haven't decided yet, see what looks best,

     

    and i'd like them to be evenly sized and apart from one another. not all tight next to each other...

     

    see what i mean?

     

    Cheers for all this

     

    really appreciate it

  6. you want me to post this back...?

     

    <?php
    
    Array
    (
        [user] => alexhoward
        [user2] => <a href="http://www.dpbolvw.net/click-2804964-10394636" target="_blank" onmouseover="window.status='http://www.argos.co.uk';return true;" onmouseout="window.status=' ';return true;"><img src="http://www.lduhtrp.net/image-2804964-10394636" width="120" height="60" alt="Argos" border="0"/></a>
    )
    
    ?>
    

     

    sorry i had to do it from the page source, as it comes up as a image link on the page

  7. Sure,

     

    no there's a link to the change_pasword.php page

     

    <?php
    //check to see if link has already been added to username
    
    $user = mysql_real_escape_string($_POST['user']);
    $user2 = htmlspecialchars($_POST['user2'],  ENT_QUOTES);
    
    $match = "SELECT link FROM memberlinks WHERE username = '$user' and link = '$user2'";
    
    $qry = mysql_query($match) 
    or die ("Could not match data because ".mysql_error()); 
    $num_rows = mysql_num_rows($qry); 
    
    if ($num_rows != 0) { 
    echo "You've already added that link.<br>"; 
    echo "<a href=change_password.php>choose another</a>";
    exit; 
    }
    
    
    else { 
    
    
    // connect to the mysql server
    $link = mysql_connect($server, $db_user, $db_pass) or die ("Could not connect to mysql because ".mysql_error());
    
    // select the database
    mysql_select_db($database) or die ("Could not select database because ".mysql_error());
    
    // insert the data
    $user = mysql_real_escape_string($_POST['user']);
    $user2 = htmlspecialchars($_POST['user2'],  ENT_QUOTES);
    $insert = mysql_query("insert into memberlinks values ('$user', '$user2')") or die("Could not insert data because ".mysql_error());
    
    // print a success message
    echo "Your link has been added!<br>"; 
    echo "Now you can <a href=change_password.php>add another link</a>"; 
    
    }
    ?>
    

  8. Thanks alot,

     

    if i move it above the get data part, will it mean that the $user2 variable is no longer defined...?

     

    here's the entire script:

     

    <?php
    
    $mysite_username = $_COOKIE["mysite_username"];
    
    $conn = mysql_connect($server, $db_user, $db_pass)
    or die ("could not connect to mysql");  #Connect to mysql
    $rs = mysql_select_db( $database, $conn )
    or die ("Could not select database"); #select database 
    
    $sql = "Select link FROM links";  //pull the users from the table
    
    $result= mysql_query($sql)
    or die(" Could not add style facts");
    
    echo "<table align=center border=1>";        // display the users in table
    $c = 0;
    while($row = mysql_fetch_array($result)) { 
       $user2 = htmlspecialchars($row['link'],  ENT_QUOTES);
       $user3 = $row['link'];
       //$user2 = $row['link'];
      if($c%5 == 0) echo "<tr height=\"200px\">"; // If the counter has ticked 6 times, start a new row.
    
    
    
    $sql2 = "SELECT link FROM memberlinks WHERE username = '$mysite_username' and link = '$user2'";
    
    $result2 = mysql_query($sql2) or die(" Could not add style facts");
    
    //$qry2 = mysql_query($result2) 
    //or die ("Could not match data because ".mysql_error()); 
    
    $num_rows = mysql_num_rows($result2); 
    
    if ($num_rows != 0) { 
    
    //if(empty($result2))
    //{
    $button = "Link Added";
    }else{
    $button = "<input type='submit' value='Add Link'>";
    }
    
    //<input type=submit>
    
    
    echo "<td><FORM action='addlinks.php' method='post'><p><input type=HIDDEN name='user' value='$mysite_username'></p><p align=center><input type=HIDDEN name='user2' value='$user2'></p><p align=center>$user3</p><p align=center>rating script here</p><p align=center>$button</p></form>";
    
      if($c%5 == 4) echo "</tr>"; // If we're drawing the 6th pic, end this row.
      $c++;
    }
    if($c%5 != 4) echo "</tr>"; // If there isn't a number of pics divisible by 6, end the row
    echo "</table>"; // end the table
    
    
    ?>
    

  9. I've got it!

     

    <?php
    
    $sql2 = "SELECT link FROM memberlinks WHERE username = '$mysite_username' and link = '$user2'";
    
    $result2 = mysql_query($sql2) or die(" Could not add style facts");
    
    $num_rows = mysql_num_rows($result2); 
    
    if ($num_rows != 0) { 
    
    $button = "Link Added";
    }else{
    $button = "<input type='submit' value='Add Link'>";
    }
    
    ?>
    

     

    but when you come back they haven't changed until you refresh the page

  10. I've tried doing this, but it's still not working?

     

    can you see where i'm going wrong...?

     

    <?php
    
    $sql2 = "SELECT link FROM memberlinks WHERE username = 'mysql_username' and link = 'user2'";
    
    $result2 = mysql_query($sql2) or die(" Could not add style facts");
    
    if(empty($result2))
    {
    $button = "<input type='submit' value='Add Link'>";
    }else{
    $button = "Link Added";
    }
    
    ?>
    

     

    Thanks!

  11. sorry,

     

    i'm not being very helpful am i

     

    basically all the links get pulled from the links table and displayed on the page.

     

    when the user selects a link to be added from their page it post onto the memberlnks table

     

    saving the user name from the cookie and the link (username, link)

     

    then on their page it brings back the link from memberlinks where the username = their username

     

    so i need to check if they have already added it, and if they have to display "Link Added"

     

    and if not display the submit button

     

     

     

  12. Hello,

     

    you're well helpful!

     

    thanks for the script, however it doesn't check if the user has added the link.

     

    it's checking if the link exsists in the links table, which is does as that's where we pulling the links from...?

     

    i need it to check in the memberlinks table where the username with the link attached exsist.

     

    is that right...?

     

    cheers mate!

  13. Hello,

     

    I'm back again :D

     

    ok two more questions before this script it perfect,

     

    well, 3, but i'll worry about the rating script later

     

    1)  this script makes the table depending on how many links there are.

        it puts each cell next to one another, then drops down to a new row when the set number has ben reached.

        However, i'd like to arrange them a bit better than this, say 25% each.

        and leave a gap between rows...?

     

    2)  When you press the "Add Link" submit button, i'd like it to change to "Link Added".

        But also i'd like them to check it the user has already added the link and if so display "Link Added"

     

    Does this make sense?

  14. ah,

     

    thanks for getting back to me mate,

     

    but i've just worked it out!

     

    the script i took from my login page was checking if the two already exsisted, and giving an error if they didn't.

     

    but i wanted this to work the other way around.

     

    sorry it accured to me a bit late

     

    it needed to be:

    $num_rows != 0

     

    was about to post to say i'd worked it out.

     

    I'm now off for the day, but will be back online at around 9am tomorrow with a table question.

     

    It relates to this, but different,

     

    so should we check this one as SOLVED!

     

    ;D

  15. oh ok,

     

    i've changed it, but now it says "you've already added that link" everytime....

     

    <?php
    
    //check to see if link has already been added to username
    
    $match = "SELECT link FROM memberlinks WHERE username = ('user') and link = ('user2')"; 
    
    $qry = mysql_query($match) 
    or die ("Could not match data because ".mysql_error()); 
    $num_rows = mysql_num_rows($qry); 
    
    if ($num_rows <= 0) { 
    echo "You've already added that link.<br>"; 
    echo "<a href=change_password.php>choose another</a>";
    exit; 
    }
    
    else {...... then it posts
    ?>
    

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