Jump to content

Brentatechnologies

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Brentatechnologies's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey Everyone, I feel I have been a tad rude around the forums...I've asked for help and I haven't even introduced myself...Please Accept my Sincerest apologies I am only young after all So An introduction to a Community of people that I feel dumb around? Here goes my self respect My name is Brent, 16 and I'm still in school and loving it, I recently (this year) hit year 11 (Australian School) and took up the Software Design and Development Course available for all of those who dare...and...I'm in love with the course, I've started a Major Assignment due at the end of Next year (YES NOT THIS YEAR), The project itself is going better than expected, I'm creating an Online Text-Based Turn Generated Game, (unitedsticks.bugs3.com ---- DAILY UPDATES) It doesn't look like much but I spend whatever time I have into learning more about PHP and MySQL, that's how I came about phpfreaks, I needed some help with dropdown boxes, and whoohooo I hit this forum. Where to I plan to Go? Well, after I finish this school I plan on hitting university and in the long run plan to be a Game Programmer, mainly because I love games, and I seem to love coding (even though I may not be good at it). What Achievements have I made? Well, at the moment, I have achieved creating a basic (very basic) map and a single player shooting game (I'll upload it one day so you can all test it out if you wish) and now this game I'm creating online is going to be my biggest achievement. Why is it big to me? Well, this is no ordinary game, I was inspired by the online text-based game (kingdomofloathing.com) and how the mechanics were working... Anyways... If you wish to know more, lend assistance, have a chat or anything else message me I'm always up for a chat Regards, Brent unitedsticks.bugs3.com
  2. As a NEWBIE PHP coder myself I'd still like to have a shot just to test myself...If this turns out to be wrong I will run in shame but nevertheless practice makes perfect... Alright, So instantly I'm going to suggest the following You said you have the following printing "Movie: movie Genre: Genre Year: year" Now I read that in your edit.php you have <form action="" method="post"> <fieldset> <legend>Enter your movies into database here!</legend> Movie: <input type ="text" name="movie" value="<?php echo 'movie';?>"> <br /> Genre: <input type ="text" name="genre" value="<?php echo 'genre';?>"/> <br /> Year: <input type ="text" name="year" value="<?php echo 'year';?>"/> <br /> <input type="submit" name="name" value="Submit" /> </fieldset> </form> Is the problem this? your not including the $_POST['movie'] ------ maybe it needs the $_POST part being part of the code? $filmID = $_POST['filmID']; $movie = mysql_real_escape_string(htmlspecialchars($_POST['movie'])); $genre = mysql_real_escape_string(htmlspecialchars($_POST['genre'])); $year = mysql_real_escape_string(htmlspecialchars($_POST['year'])); Other than that....I've got nothing else...i'll be interested in what the problem is (it'll help my learning capabilities of reading code) Sorry if this is wrong Brent.
  3. Hey There, You may be able to use a ("SELECT * FROM) from database depending on what you are getting from the database For instance You have a Table for which player is vsing who, but the viewer wants to know what pieces the players vs'ing have taken you'd be able to use the $query = mysql_query("select * FROM "TABLE HERE" WHERE "PLAYER'S VSING HERE" = 'DISPLAY THE PLAYERS and what pieces are taken'"); // Queries the Database to check if the Players have taken a piece and if so what piece has been taken Obviously you'd need to setup your database to have Players, Pieces and whatever else... (I'm thinking you made your own chess game?) if not let me know and i'll try help with whatever else
  4. Thanks for your reply, I added in to make sure I have everything working, so I gave a try of your code and it returns an error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\unitedsticks\insert.php on line 58 I have never seen an error like that...mind explaining if you have the time Regards Brent.
  5. Hey, I'm getting an undefined index in my final test and would like to know that this is fixed and I don't have to worry about any troubles.. here is what's going on Notice: Undefined index: register in C:\wamp\www\unitedsticks\insert.php on line 6 Registered! Return Notice: Undefined index: class in C:\wamp\www\unitedsticks\insert.php on line 58 1 record added Now...It Registers and does everything it's meant to, I just want the undefined index gone...here's my coding: THIS IS insert.php <?php session_start(); mysql_connect("localhost", "root", ""); // Server connection mysql_select_db("myfirstdatabase"); // Database selection $page = $_POST['register']; // Setting the page value $user = $_POST['username']; // Setting the user value $pass = $_POST['password']; // Setting the pass value if($page == 1) { //This means that the page is the register form so the register form code goes here $query = mysql_query("select * FROM userdata WHERE username = '$user'"); // Queries the Database to check if the user already exists if(mysql_num_rows($query) !== 0) // Checks if there is any rows with that user { echo "THIS USER IS ALREADY TAKEN!"; // Stops there } else { mysql_query("INSERT INTO userdata (username, password) VALUES('$user', '$pass')"); // Inserts into the database. echo "REGISTERED! <BR> <a href='index.php'>Go to the login page</a>"; //Link and text to go to the login } } ?> <?php if($page == 0) { //This means that the page is the login form so the register form code goes here $query = mysql_query("SELECT username FROM userdata WHERE username = '$user'"); // Queries the Database to check if the user doesn't exist if(mysql_num_rows($query) == 0) // Checks if there is any rows with that user { echo "User doesn't exist"; // Stops there } $query = mysql_query("SELECT username FROM userdata WHERE username = '$user' AND password = '$pass'"); if(mysql_num_rows($query) !== 0) // Checks if there is any rows with that user and pass { echo "Registered!<BR> <a href='index.php'>Return</a>"; //Link and text to go to the login $_SESSION['LOGGEDIN'] = 1; } } ?> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); $sql="INSERT INTO register (username, password, class) VALUES ('$_POST[username]','$_POST[password]','$_POST[class]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> And my other coding: <html> <body> <center><p><p><!-- Main Table(You can define padding accordingly) --> <table width="50%" border="0" cellspacing="0" cellpadding="5"> <td width="50%"> <!-- Table on left side --> <table width="90%" height="100%" border="1" cel1pacing="0" cellpadding="0" BORDERCOLOR="#007FFF"> <body style="background-color:;"> <td><h3><center><h3 style="background: blue; color: white;">Create Account Here<br></font></center></h2><p> <h4><p>Login Information</h4></p> <form action="insert.php" method="post"> Username: <input type="text" name="username" /><br> Password: <input type="password" name="password" /> <h3>Choose your Class</h2> <table width="100%" border="1"> <tr> <p> <label> <input type="radio" name="class" value="Clubber" id="SC" /> Clubber</label> <br /> <label> <input type="radio" name="class" value="Pastamancer" id="PM" /> Pastamancer</label> <br /> <label> <input type="radio" name="class" value="" id="" /><br> <center><input type="submit" /></center> </label> <br /> </p></td> </tr> </table> </form> </body> </html> Thanks for any help... Brent.
  6. Hey There, I don't know if it matters with your database connect setup <?php define('DB_NAME', 'raggsweb_oltusers'); define('DB_USER', 'raggsweb_raggs'); define('DB_PASSWORD', 'XXXXXXX'); define('DB_HOST', 'localhost'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); should be <?php define('DB_HOST', 'localhost'_; define('DB_USER', 'raggsweb_raggs'); define('DB_PASSWORD', 'XXXXXXX'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); (It may be that your not corresponding in order) or $result = mysql_query ('SELECT * FROM Users') or die ('Error: '.mysql_error ()); possibly $query = mysql_query("select * FROM Users WHERE username = '$user'"); // Queries the Database to check if the user already exsists Change the values that are different to the values from your database Let me know if this wasn't the problem... This is all I could see may be wrong
  7. I meen, your php code. CODE: <center> <?php echo "<title>Register Here!</title>"; //Page title echo "<h1>Register Page</h1>"; //Heading echo "<form action='finished.php' method='post'>"; echo "Username: <input type='text' name='usrnme' /><br>"; //Username box echo "Password: <input type='password' name='pwd' /> <br>"; //Password box echo "<input type='hidden' name='registerform' value='1'>"; //Hidden Field. echo "Character: <input type='text' name='class' /><br>"; //Class Field echo "<input type='submit' value='submit'>"; //Submit button. echo "</form>"; ?> </center> finished.php: <?php session_start(); mysql_connect("", "", ""); // Server connection mysql_select_db(""); // Database selection $page = $_POST['registerform']; // Setting the page value $user = $_POST['usrnme']; // Setting the user value $pass = $_POST['pwd']; // Setting the pass value if($page == 1) { //This means that the page is the register form so the register form code goes here $query = mysql_query("select * FROM userdata WHERE username = '$user'"); // Queries the Database to check if the user already exists if(mysql_num_rows($query) !== 0) // Checks if there is any rows with that user { echo "THIS USER IS ALREADY TAKEN!"; // Stops there } else { mysql_query("INSERT INTO userdata (username, password) VALUES('$user', '$pass')"); // Inserts into the database. echo "REGISTERED! <BR> <a href='index.php'>Go to the login page</a>"; //Link and text to go to the login } } ?> <?php if($page == 0) { //This means that the page is the login form so the register form code goes here $query = mysql_query("SELECT username FROM userdata WHERE username = '$user'"); // Queries the Database to check if the user doesn't exist if(mysql_num_rows($query) == 0) // Checks if there is any rows with that user { echo "User doesn't exist"; // Stops there } $query = mysql_query("SELECT username FROM userdata WHERE username = '$user' AND password = '$pass'"); if(mysql_num_rows($query) !== 0) // Checks if there is any rows with that user and pass { echo "LOGGED IN! <BR> <a href='logged.php'>Go to the logged in</a>"; //Link and text to go to the login $_SESSION['LOGGEDIN'] = 1; } }
  8. Will do now sorry CODE: <form enctype="multipart/form-data" action="sendfile.php" method="post"> Gender: <select name="gender"> <option value="Male"> Male</option> <option value="Female">Female</option> </select> Name:<input type="text" name="name"> <input type="submit" value="Add"> </form> (example of what I want... except in php?) database code: This is what i'm having trouble with....
  9. Hey Everyone... First off, I am only a young web developer and i'm working on a school project and am making a text-based game online... Now what i'm having trouble with... I want a drop-down list that has a list of characters classes Clubber Mixer Sauceror Tamer And I want whatever is selected to be placed into the database along with the username/password (THIS ALL WORKS FINE JUST NOT THE DROP DOWN LIST) All help appreciated
×
×
  • 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.