Jump to content

bubblegum.anarchy

Members
  • Posts

    526
  • Joined

  • Last visited

    Never

Posts posted by bubblegum.anarchy

  1. Change this line:

     

    <?php
       $tsel = mysql_query("select * from `users` where `userlevel`='0' and `status`='alive' order by `rank` desc limit 10");
    while ($top=mysql_fetch_array($tsel)) { // line 36
          print "<tr><td></center><a href=profile.php?viewuser=$top[username]>$top[username][/url]</td><td align=right>$top[rank]</td></tr>";
       }
       ?>
    

     

    To this:

    <?php
       $tsel = mysql_query($query = "select * from `users` where `userlevel`='0' and `status`='alive' order by `rank` desc limit 10") or trigger_error(mysql_error()."<PRE>".$query."</PRE>", E_USER_ERROR);;
    while ($top=mysql_fetch_array($tsel)) { // line 36
          print "<tr><td></center><a href=profile.php?viewuser=$top[username]>$top[username][/url]</td><td align=right>$top[rank]</td></tr>";
       }
       ?>
    

     

    ... and investigate the mysql error.

  2. Change this line:

     

    $sql = "UPDATE school_book SET title='$title', category='$category', type='$type', processed='$processed', image='$image', url='$url', description='$description', username='$username', user='$user' WHERE id=$id";
    //replace school_book with your table name above
    $result = mysql_query($sql) or die(mysql_error());
    

     

    To this:

     

    $sql = "UPDATE school_book SET title='$title', category='$category', type='$type', processed='$processed', image='$image', url='$url', description='$description', username='$username', user='$user' WHERE id=$id";
    //replace school_book with your table name above
    die($sql);
    $result = mysql_query($sql) or die(mysql_error());
    

     

    and post the result contained in $sql;

  3. Something like this:

     

    SELECT the_friend.id, the_friend.name
    FROM users AS person
        INNER JOIN friends AS friend_of_theres ON person.id = friend_of_theres.friendid 
        INNER JOIN users AS the_friend ON friend_of_theres.userid = the_friend.id
        LEFT JOIN friends AS friend_of_mine ON friend_of_theres.userid = friend_of_mine.friendid AND friend_of_mine.userid = person.id
    WHERE person.id = $_SESSION['userID'] AND friend_of_mine.userid IS NULL
    

  4. A table with a user id and product id

     

    vote.user_id

    vote.product_id

     

    To verify if the user has voted on any product:

    SELECT * FROM vote WHERE user_id = $user_id
    

     

    To get a total of votes for a product:

    SELECT count(*) FROM vote WHERE product_id = $product_id
    
    OR
    
    SELECT product_id, count(*) AS votes FROM vote GROUP BY product_id ORDER BY votes DESC # most votes first
    

  5. First of all you need to give name to the form and then using the java script get the values of cat and subcat as given below

     

    $cat=document.formname.cat.options[document.formname.cat.selectedIndex].value

    $sub=document.formname.sub.options[document.formname.sub.selectedIndex].value

    A server side variable can not be assigned a client side javascript value.

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