Jump to content

vaan

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Posts posted by vaan

  1. no it doesn\'t echo the username. Also not with the code you said.. This is how i send the username in..

     

    update1.php?userid=admin

     

    Does anyone see the problem.

     

    And can anyone tell me how to show the things i allready putted in the database in my input fields?? :?: :?:

  2. Hi,

     

    Everyone helped me out on the insert question but i now have a update question

    When i press submit in this script it updates.. but it just makes 1 time a new row.. With the update i made.. Every time i try to update it again it just updates that row... But not the username i sended with

    update1.php?userid=admin

    Do you still get it?? :)

    I really can\'t fix it :roll:

     

    Here is my code

    [php:1:6b0552874a]

    <HEAD>

    <? include \"include/db.php\";?>

    <TITLE>UPDATE USER</TITLE>

    </HEAD>

    <BODY>

    <?

    $userid = $_GET[\'userid\'];

     

    $server = \"$host\";

    $mysql_user = \"$user\";

    $mysql_password = \"$pass\";

    $database = \"$db\";

     

    $link = mysql_connect($server, $mysql_user, $mysql_password)

    or die(\"Could not connect to mysql!<br />mysql error: \" . mysql_error());

     

    // Selecting databse

    mysql_select_db ($database, $link)

    or die(\"Could not select db!<br />mysql error: \" . mysql_error());

     

    if ($sent){

    print(\"<BR><BR><CENTER>THE USER IS UPDATED<BR>updated user:<BR>$userid <BR>new password:<BR>$password<BR><BR>new userlevel:<BR>$userlevel<BR><BR>new webspace:<BR>$webspace<BR><BR>\");

    } else {

    print(\"<BR><BR><CENTER><BR><BR><BR><FORM ACTION=update1.php METHOD=post>

    Username: $userid<BR>

    Password: <INPUT TYPE=PASSWORD NAME=password class=button><BR>

    Email adress: <INPUT TYPE=TEST NAME=email class=button><BR>

    Fullname <INPUT TYPE=TEST NAME=name class=button><BR>

    Package: <select name=userlevel>

    <option value=basic>basic</option>

    <option value=medium>medium</option>

    <option value=large>large</option>

    <option value=reseller>reseller</option>

    <option value=admin>admin</option>

    </select> <BR>

    Webspace: <INPUT TYPE=TEST NAME=webspace class=button><BR>

    <BR><BR><INPUT TYPE=SUBMIT VALUE=SUBMIT NAME=sent class=button></FORM><BR><BR><BR>\");

    }

    if ($sent){

    $userid = $_GET[\'userid\'];

     

    $sql2 = \"update user set password = \'$password\' where userid = \'$userid\'\";

     

    $result = mysql_query($sql2)

    or die(\"Couldn\'t execute query.1\");

    $sql3 = \"update user set userlevel = \'$userlevel\' where userid = \'$userid\'\";

     

    $result = mysql_query($sql3)

    or die(\"Couldn\'t execute query.2\");

    $sql3 = \"update user set webspace = \'$webspace\' where userid = \'$userid\'\";

     

    $result = mysql_query($sql3)

    or die(\"Couldn\'t execute query.3\");

    $sql3 = \"update user set fullname = \'$name\' where userid = \'$userid\'\";

     

    $result = mysql_query($sql3)

    or die(\"Couldn\'t execute query.4\");

    $sql3 = \"update user set email = \'$email\' where userid = \'$userid\'\";

     

    $result = mysql_query($sql3)

    or die(\"Couldn\'t execute query.5\");

    $sql3 = \"update user set userid = \'$userid\' where userid = \'$userid\'\";

     

    $result = mysql_query($sql3)

    or die(\"Couldn\'t execute query.6\");

     

    print (\"Users Info Successfully Updated!\");

    }

    ?>

    </BODY></HTML>

    [/php:1:6b0552874a]

     

    thanks for the help

  3. CREATE TABLE `user` (                                                                                                                                                                                                                                                                                                                                                                                     
    
            `ID` int(11) NOT NULL auto_increment,                                                                                                                                                                                                                                                                                                                                                                    
    
            `userid` varchar(100) NOT NULL default \'\',                                                                                                                                                                                                                                                                                                                                                               
    
            `password` varchar(16) NOT NULL default \'\',                                                                                                                                                                                                                                                                                                                                                              
    
            `fullname` varchar(100) NOT NULL default \'\',                                                                                                                                                                                                                                                                                                                                                             
    
            `email` varchar(100) NOT NULL default \'\',                                                                                                                                                                                                                                                                                                                                                                
    
            `userlevel` varchar(100) default NULL,                                                                                                                                                                                                                                                                                                                                                                   
    
            `webspace` varchar(100) default NULL,  

    this is my table structure

  4. i just get as error print 0 (zero)..

     

    here is a little piece of my code, it contains many more but that is setting up the table... i hope you all can help me...

    include "include/db.php"; 
    
    
    
    $server = "$host"; 
    
    $mysql_user = "$user"; 
    
    $mysql_password = "$pass"; 
    
    $database = "$db"; 
    
    
    
    // Connecting to mysql 
    
    $link = mysql_connect($server, $mysql_user, $mysql_password) 
    
       or die("Could not connect to mysql!<br />mysql error: " . mysql_error()); 
    
    
    
    // Selecting databse 
    
    mysql_select_db ($database, $link) 
    
       or die("Could not select db!<br />mysql error: " . mysql_error());
    
    
    
    print ("
    
    <BR><CENTER><BR><BR><BR>
    
    <BR><BR><FORM ACTION=setup1.php METHOD=post>Username:<BR> <INPUT TYPE=TEXT NAME=username class=button><BR>
    
    <BR>Password:<BR> <INPUT TYPE=password NAME=password class=button><BR><BR>
    
    <br>Fullname:<BR> <INPUT TYPE=TEXT NAME=fullname class=button><BR>
    
    <br>Email:<BR> <INPUT TYPE=TEXT NAME=email class=button><BR>
    
    
    
    <INPUT TYPE=SUBMIT VALUE=SUBMIT NAME=sent class=button></FORM><BR><BR><BR>");
    
    
    
    
    
    $sql_8 = "INSERT INTO user (userid, password, fullname, email, userlevel, webspace) VALUES (\'$username\', \'$password\', \'$fullname\', \'$email\', \'admin\', \'0\');";
    
    echo mysql_errno() . ": " . mysql_error(). "n";
    
    print "()";
    
    $result1 = mysql_query($sql8)
    
     or die("Couldn\'t execute query.1");
    
    $sql1 = "INSERT INTO settings (adminame, email) VALUES (\'$fullname\', \'$email\');";
    
    $result = mysql_query($sql1)
    
     or die("Couldn\'t execute query.2");

  5. hello,

     

    I must say i like this board... :)

     

    but i have a problem for days now..

     

    I have made this piece and it just won\'t work.. Can any one tell me what\'s wrong?? Oh and it has more $results in the code..

     

    
    $sql8 = "INSERT INTO user (userid, password, fullname, email, userlevel, webspace) VALUES (\'$username\', \'$password\', \'$fullname\', \'$email\', \'admin\', \'0\');";
    
    
    
    $result = mysql_query($sql8)
    
     or die("Couldn\'t execute query.1");

    tnx

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