SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 56
  1. #26
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now it only displays "user" :P

  2. #27
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have problem with variable $userlevel.
    Where from you have $userlevel ?? I think it's always empty.

    Try:
    PHP Code:
    <?php

    echo $userlevel;

    // ...

    ?>
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  3. #28
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nothing displays

  4. #29
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As I said: You have problem with variable $userlevel not with if...elseif...else statement.
    Where from you have $userlevel ??
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  5. #30
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    include_once "connect.php";

    $sql = mysql_query("SELECT * FROM users WHERE username='$username'") or die(mysql_error());

    while ($row = mysql_fetch_array($sql))

    $userlevel=$row['userlevel'];

  6. #31
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure ...
    ... table users isn't empty ??
    ... $username is mod/admin ??

    ---updeted---
    Btw, remember that:
    'admin' != 'Admin'
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  7. #32
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes my db is 100% accurate

  8. #33
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    include_once "connect.php";

    $sql mysql_query"SELECT * FROM users WHERE username='$username'" ) or die( mysql_error() );

    $row mysql_fetch_array$sql ); // you can not put this in a while statement if you have only one row

    if( $row'userlevel' ] == 'Admin' )
    {
        echo 
    '<font color=blue><b>Admin</b></a>';
    }
    elseif( 
    $userlevel == 'Moderator' )
    {
        echo 
    '<font color=red><b>Mod</b></a>';
    }
    else
    {
         echo 
    '<font color=red><b>User</b></a>';
    }
    ?>
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  9. #34
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mike_mech... YOU ARE A GENIUS!! You found the problem! Thank You Very Much!

  10. #35
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by TacMaf
    mike_mech... YOU ARE A GENIUS!! (...)
    I know :P (kidding)

    Just ask when you have problem.

    Best regards, Michał (Mike in Polish)



    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  11. #36
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry to ask for help again but there is a problem with this somewhere:

    <?php
    if ($money <= '5000')
    {
    echo 'Empty Pockets';
    }
    elseif ($money > '5000' && <= '50000')
    {
    echo 'Penny Picker';
    }
    elseif ($money > '50000' && <= '250000')
    {
    echo 'Spare Change';
    }
    elseif ($money > '250000' && <= '1000000')
    {
    echo 'Enough';
    }
    elseif ($money > '1000000' && <= '5000000')
    {
    echo 'Wealthy';
    }
    elseif ($money > '5000000' && <= '10000000')
    {
    echo 'Rich';
    }
    elseif ($money > '10000000' && <= '25000000')
    {
    echo 'Richer Than Rich';
    }
    elseif ($money > '25000000' && <='50000000')
    {
    echo 'Burning Paper';
    }
    elseif ($money > '50000000' && <= '100000000')
    {
    echo 'Famous Rich Icon';
    }
    elseif ($money > '100000000')
    {
    echo 'Legendary Rich';
    }
    ?>




  12. #37
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php

    if( $money <= 5000 )
    {
        echo 
    'Empty Pockets';
    }
    elseif( ( 
    $money 5000 ) && ( $money <= 50000 ) )
    {
        echo 
    'Penny Picker';
    }
    elseif( ( 
    $money 50000 ) && ( $money <= 250000 ) )
    {
        echo 
    'Spare Change';
    }

    // ...

    elseif( $money 100000000 )
    {
        echo 
    'Legendary Rich';
    }
    ?>
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  13. #38
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    again mike... You are a genius!

  14. #39
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?php

    // Connect to the database



    mysql_select_db($dbname); // select database

    $quote = $_REQUEST['quote'];//get quote from form

    $img = $_REQUEST['image'];//get img from form

    $music = $_REQUEST['music'];// get music from form


    $username=$_SESSION['username'];

    $request = "UPDATE `users` WHERE $username( `profile` , `image` , `music`)

    VALUES (

    '$quote', '$img', '$music');";

    $result = mysql_query($request);

    if($result){

    echo "Update was succesful";

    } else {

    echo "Update failed";

    }

    ?>


    can anybody see anything wrong with this?
    Last edited by TacMaf; Dec 5, 2005 at 16:21.

  15. #40
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think its something wrong with my $_SESSION['username']

  16. #41
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't have session_start():
    PHP Code:
    <?php

    session_start
    ();

    // ... your script

    ?>
    It's not very smarty to show to us your password and login to DB :P
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  17. #42
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops

  18. #43
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?php

    // Connect to the database

    ...

    mysql_connect($server,$dbuser,$dbpass) or die ("Could not establish connection"); // make connection

    mysql_select_db($dbname); // select database

    $profile = $_REQUEST['profile'];//get quote from form

    $image = $_REQUEST['image'];//get img from form

    $music = $_REQUEST['music'];// get music from form

    session_start();
    $username=$_SESSION['username'];

    $query = mysql_query("UPDATE users SET profile='$profile',Image='$image',Music='$music' WHERE '$username'");

    $result = mysql_query($query);

    if($result){

    echo "Update was succesful";

    } else {

    echo "Update failed";

    }

    ?>


    ok this is my script now and i still get "Update Failed"

  19. #44
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have an error in SQL query in WHERE statament:
    PHP Code:
    <?php

    // ...

    // You have
    $query mysql_query("UPDATE users SET profile='$profile',Image='$image',Music='$music' WHERE '$username'");

    // should be
    $query mysql_query("UPDATE users SET profile='$profile',Image='$image',Music='$music' WHERE username = '$username'");

    // ...

    ?>
    ----updeted----

    BTW:
    PHP Code:
    <?php

    // ...

    $query "UPDATE users SET profile='$profile',Image='$image',Music='$music' WHERE username = '$username'"// without mysql_query

    $result mysql_query($query);

    if(
    $result){

    echo 
    "Update was succesful";

    } else {

    echo 
    "Update failed";

    }


    ?>
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  20. #45
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still update failed

  21. #46
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh wait ive done the updated part and now it says update sucessful but nothing has changed in the db

  22. #47
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure, you're sending different data than you have in DB?

    Update with the same data is not an update :-)



    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  23. #48
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes the data is different. maybe its my profile form?

    <body bgcolor=#333333>
    <font face=verdana size=1>
    <center>

    <table align=center width=100%>
    <tr>

    <td rowspan=2 align=center width=50%>

    <form name="prof1" method="Update" action="profilescript.php">
    <font color=blue>
    <font color=black>
    <br><br>
    <br><Br>
    <table align=center width=100% cellspacing=0 cellpadding=2 border=1 bordercolor=black bgcolor=#5e5e5e>
    <tr><td background=tablebg.jpg align=center><font face=verdana size=1 color=white><b>Profile Quote</td></tr>
    <tr><td align=center>
    <textarea style="background: #a7a7a7; color: black; font-size: 8pt; font-family: verdana; border-width: 1; border-color: black;" name=profile rows=10 cols=50>
    </textarea><br></td></tr>
    <tr background="tablebg.jpg"><td align=center><font face=verdana size=1 color=white><b>Profile Picture</td></tr>
    <tr><td><font face=verdana size=1><b>Picture: <input type=text size=38 name=image style="background: #a7a7a7; color: black; font-size: 8pt; font-family: verdana; border-width: 1; border-color: black;" value="http://"></td></tr>
    <tr background="tablebg.jpg"><td align=center><font face=verdana size=1 color=white><b>Profile Music</td></tr>
    <tr><td><font face=verdana size=1><b>Music: <input type=text size=38 name=music style="background: #a7a7a7; color: black; font-size: 8pt; font-family: verdana; border-width: 1; border-color: black;" value="http://"></td></tr>
    <tr><td align=center><input type=submit style="background: #808080; color: black; font-size: 8pt; font-family: verdana; border-width: 1; border-color: black;" name=changeprofile value="Update"></td></tr>
    </table>
    </form>
    <?php include($_SERVER['DOCUMENT_ROOT'].'/profilescript.php');
    ?>
    </td>



    <tr>

    <td align=center width=50%>

    <table align=center width=100% cellspacing=0 cellpadding=2 border=1 bordercolor=black bgcolor=#5e5e5e>
    <tr><td align=center background=tablebg.jpg><font face=verdana size=1 color=white><b>Friend's</td></tr>
    <tr><td><font size=1><font face=verdana><center>You have no friends</td></tr>

    <tr><td><center><input type="text" style="background: #a7a7a7; color: black; font-size: 8pt; font-family: verdana; border-width: 1; border-color: black;" name="friend"></td></tr>
    <tr><td><center><input type="submit" style="background: #808080; color: black; font-size: 8pt; font-family: verdana; border-width: 1; border-color: black;" name="addfriend" value="Add!">&nbsp;<input type="submit" name="removefriend" style="background: #808080; color: black; font-size: 8pt; font-family: verdana; border-width: 1; border-color: black;" value="Remove!">
    </td></tr>
    </table>

  24. #49
    SitePoint Enthusiast mike_mech's Avatar
    Join Date
    Nov 2005
    Location
    Poland
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tell me what displays:
    PHP Code:
    <?php

    // ...
    echo $query "UPDATE users SET profile='$profile',Image='$image',Music='$music' WHERE username = '$username'";
    // ...
    ?>
    Off Topic:

    I will answer You tomorow.
    It's 11:47 p.m. in Poland
    Sorry, about my english, it's not my national language :/
    ___
    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the the universe."
    - Albert Einstein

  25. #50
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    UPDATE users SET profile='test',Image='http://',Music='http://' WHERE username = ''Update was succesful


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
  •