Jump to content

polardude1983

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

polardude1983's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. of course thats right weight / 10 duh so if they enter 228. it stores it as 22.8 which it then actually rounds it up to 23. which is ok i guess kinda throws things off. i would actually like it to always round down and never up. thanx for your help so far
  2. well I'm wanting to keep the original 228 number as it is used later. but i want to extract the first 2 numbers from that 3 digit number and still keep it as an integer. if someone enters 128 ill use that number later, but when i extract the first 2 numbers i will get 12. and i will need to use that new number later too.
  3. I have a current_weight field. where ppl have their weight put in there so. if someone enters their weight in the form as 228 then the new_weight field says 22 This works if i keep it as new_weight CHAR(2), but then the 22 is a character and cannot be added to anything else since it is not an integer so how can i do it so where new_weight is an integer but only grabs the first 2 numbers from 228? new_weight INT(2) does not work it still grabs all 3 any idea on how to do this? im very puzzled
  4. sorry i mean it was this way and it didn't work. mysql_query ( "INSERT INTO members (`username`, `password`, `start_weight_big` CHAR(2), start_weight_dec) VALUES ('$username', '$password', '$start_weight_big', $start_weight_dec)" );
  5. I come up with an error. You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHAR(2) mysql_query ( "INSERT INTO members (`username`, `password`, `start_weight_big CHAR(2)`, start_weight_dec) VALUES ('$username', '$password', '$start_weight_big', $start_weight_dec)" ); this is in the php file. I have the html file which gets the user input then calls the php file to input in the database.
  6. I have a current_weight field. where ppl have their weight put in there so. if someone enters their weight in the form i have as 228 then the current_weight field says 228 and that works. but what i want is for it to grab the first 2 numbers from current_weight and put it into a field called new_weight. so if someone puts 228 in current_weight, new_weight is 22 if someone puts 180 in current_weight, new_weight is 18 any idea on how to do this? im very puzzled
  7. Currently I have a login screen once the person logs in it shows the persons username. the persons username is $username so what i basically want is www.mysite.com/$username/myhome.html so if john logs in the when he clicks the above link it will actually say www.mysite.com/john/myhome.html but what it actually says is www.mysite.com/$username/myhome.html it doesnt replace the persons user name with $username below is the code <?php require_once('common.php'); $error = '0'; if (isset($_POST['submitBtn'])){ // Get user input $username = isset($_POST['username']) ? $_POST['username'] : ''; $password = isset($_POST['password']) ? $_POST['password'] : ''; // Try to login the user $error = loginUser($username,$password); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Micro Login System</title> <link href="style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <?php if ($error != '') {?> <div class="caption">Site login</div> <div id="icon"> </div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="loginform"> <table width="100%"> <tr><td>Username:</td><td> <input class="text" name="username" type="text" /></td></tr> <tr><td>Password:</td><td> <input class="text" name="password" type="password" /></td></tr> <tr><td colspan="2" align="center"><input class="text" type="submit" name="submitBtn" value="Login" /></td></tr> </table> </form> <a href="register.php">Register</a> <?php } if (isset($_POST['submitBtn'])){ ?> <div class="caption">Login result:</div> <div id="icon2"> </div> <div id="result"> <table width="100%"><tr><td><br/> <?php if ($error == '') { echo '<a href="http://www.junglewebdesign.com/ '.' $username ">here </a>'; echo " $username Now you can visit the index page!"; } else echo $error; ?> <br/><br/><br/></td></tr></table> </div> <?php } ?> <div id="source">Micro Login System v 1.0</div> </div> </body>
×
×
  • 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.