Jump to content

Shredon

Members
  • Posts

    15
  • Joined

  • Last visited

Profile Information

  • Location
    Poland

Shredon's Achievements

Member

Member (2/5)

0

Reputation

  1. Okay, thank you for explaining mac_gyver Im just too distracted to focus since last week, that's why I didn't noticed that
  2. Amazing 馃ゲ. Thank you. Damn I know, Im just total newbie, but for sure I need to understand it, sooner better, because code is getting longer and longer. PHP is just a bit strange, but it's just new thing for me. Thank you for big help and your time
  3. Hi. Im trying to make galaxy browser, where you can search for planets of other players. I want to make it like that if its good idea: - get the record where player's ID (column users_id) is 1 (because there's no log in system yet) from it's already saved system that was watched last time (column users_galaxyViewSystem) from the "users" table - save that last watched system number as $testowanySystem - use $testowanySystem to get planet name (column planets_name) from the table "planets" where planets_galaxy = 1, planets_starsystem = $testowanySystem and planets_planet = 1 I was trying to do it in this way, but I think I'm too stupid still: <?php $testowanaGalaktyka = 1; $testowanaPlaneta = 1; $testowanyGracz = 1; $sql = "SELECT users_galaxyViewSystem FROM users WHERE users_id = 1"; $result = $conn->query($sql); $testowanySystem = $_GET['users_galaxyViewSystem']; $sql2 = "SELECT planets_name FROM planets WHERE planets_galaxy = $testowanaGalaktyka AND planets_starsystem = $testowanySystem AND planets_planet = $testowanaPlaneta"; $result = $conn->query($sql2); if($result->num_rows>0) { while($row = $result->fetch_assoc()) { echo ''.$row["planets_name"].""; } } ?>
  4. Yup, i just noticed my FREE hosting expired 24.07.2022 so today. I've paid that like 2$ and it's working again. Thank you :). And also thank you for explaining 1xx 2xx 3xx 4xx 5xx errors. By the way if it's not good to mix <form> with <table>, how to construct the login/register form witout the table?
  5. Im sorry, but I don't understand totally 馃槗. I was using many tutorials to write that "site" and it was going easy until this moment. My registration was working, but now it doesn't. I don't even know how to test it because its always showing me that error and Im soo newbie 馃槶. I don't know where to put this exactly <?php echo '<pre>'; print_r($_POST); echo '</pre>'; ?> <form method='post'> <input type='text' name='somefield'> <input type='submit'> </form> Now I got this here and I've modified form by deleting action="registerFinal.php" from it, but still shows that error: <tbody> <form method="post"><!-- ten fragment inputow jest wysylany submitem do pliku registerFinal.php --> <tr class="logRegSiteTextBox"> <td>login: </td> <td><input type="text" placeholder="tak" title="nie" name="loginREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>e-mail: </td> <td><input type="text" placeholder="tak" title="nie" name="emailREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>has艂o: </td> <td><input type="password" placeholder="tak" title="nie" name="passwordREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>powt贸rz has艂o: </td> <td><input type="password" placeholder="tak" title="nie" required></td> </tr> <tr> <td></td> <td><input type="submit" value="Zarejestruj si臋" class="myButtonREG"></td> </tr> </form> <?php echo '<pre>'; print_r($_POST); echo '</pre>'; ?> </tbody> I cannot mix form with html table... then Im not mixing it now: <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Rejestracja</title> <link rel="icon" href="./pic/icon.png"> </head> <body style="background-color:#000000;"> <main> <link rel="stylesheet" type="text/css" href="style.php"/> <div class="logRegSiteImage"> <br> <div class="logRegSiteText">Fraktomeda</div> <div class="logRegSite2Text">Rozleg艂y Wszech艣wiat czeka!</div> <br><br><br> <div class="logRegSite3Text">Strategiczna gra przegl膮darkowa, w kt贸rej przejmujesz w艂adz臋 nad planet膮, aby wkr贸tce kolonizowa膰 kolejne 艣wiaty, zawiera膰 sojusze i niszczy膰 wrog贸w. To tutaj do艣wiadczysz ogromu Wszech艣wiata, jego wszelkich wspania艂o艣ci oraz zjawisk kt贸re badane s膮 przez naukowc贸w od wiek贸w. Przejmij dowodzenie ju偶 teraz i poka偶, jak buduje si臋 pot臋g臋 mi臋dzygalaktyczn膮!</div> <br><br> <div id="blackBG"> <a href="./login.php" class="myButtonLOG">Zaloguj si臋</a> <a href="./register.php" class="myButtonREG">Zarejestruj si臋</a> </div> <br><br><br> <table class="horizontalCenter"> <thead> <tr> <th colspan="3" class="logRegSite3Text">Rejestrowanie</th> </tr> </thead> <tbody> <!--<form method="post"><!-- ten fragment inputow jest wysylany submitem do pliku registerFinal.php <tr class="logRegSiteTextBox"> <td>login: </td> <td><input type="text" placeholder="tak" title="nie" name="loginREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>e-mail: </td> <td><input type="text" placeholder="tak" title="nie" name="emailREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>has艂o: </td> <td><input type="password" placeholder="tak" title="nie" name="passwordREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>powt贸rz has艂o: </td> <td><input type="password" placeholder="tak" title="nie" required></td> </tr> <tr> <td></td> <td><input type="submit" value="Zarejestruj si臋" class="myButtonREG"></td> </tr> </form>--> </tbody> </table> </div> <form method="post"> <input type="text" placeholder="tak" title="nie" name="loginREGfield" required> </form> <?php echo '<pre>'; print_r($_POST); echo '</pre>'; ?> </main> </body> </html> Not working, same problem
  6. URL of my site is http://testnowejgierki.cba.pl. Then after clicking "Zarejestruj si臋" (register), it goes to the register.php, because this is index of course. Then after clicking submit ("Zarejestruj"), it shows that error with URL http://testnowejgierki.cba.pl/registerFinal.php
  7. I think this error started to appear when I've added timestamp column for the date of registration to the "users" table in database. I did it manually through phpMyAdmin... but it's strange, because then I've deleted this column to go back to the previous table structure... But error didn't disappeared
  8. Yes, and yes. I just have one folder for images, but every scrypt is outside of it in same location I've changed require("connect.php"); to require "connect.php"; but still 405 Not Allowed nginx shows
  9. Im sorry, I just forgot to add it because it's earlier version of that script, but this: <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Rejestracja</title> <link rel="icon" href="./pic/icon.png"> </head> <body style="background-color:#000000;"> <main> <link rel="stylesheet" type="text/css" href="style.php"/> <div class="logRegSiteImage"> <br> <div class="logRegSiteText">asdfasdf</div> <div class="logRegSite2Text">asdfasdf</div> <br><br><br> <div class="logRegSite3Text">asdfasdf</div> <br><br> <div id="blackBG"> <a href="./login.php" class="myButtonLOG">Zaloguj si臋</a> <a href="./register.php" class="myButtonREG">Zarejestruj si臋</a> </div> <br><br><br> <table class="horizontalCenter"> <thead> <tr> <th colspan="3" class="logRegSite3Text">Rejestrowanie</th> </tr> </thead> <tbody> <form action="registerFinal.php" method="post"><!-- ten fragment inputow jest wysylany submitem do pliku registerFinal.php --> <tr class="logRegSiteTextBox"> <td>login: </td> <td><input type="text" placeholder="tak" title="nie" name="loginREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>e-mail: </td> <td><input type="text" placeholder="tak" title="nie" name="emailREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>has艂o: </td> <td><input type="password" placeholder="tak" title="nie" name="passwordREGfield" required></td> </tr> <tr class="logRegSiteTextBox"> <td>powt贸rz has艂o: </td> <td><input type="password" placeholder="tak" title="nie" required></td> </tr> <tr> <td></td> <td><input type="submit" value="Zarejestruj si臋" class="myButtonREG"></td> </tr> </form> </tbody> </table> </div> </main> </body> </html> still doesn't working. Error is just same
  10. register.php looks like this: <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Rejestracja</title> <link rel="icon" href="./pic/icon.png"> </head> <body style="background-color:#000000;"> <main> <link rel="stylesheet" type="text/css" href="style.php"/> <div class="logRegSiteImage"> <br> <div class="logRegSiteText">asdfasdf</div> <div class="logRegSite2Text">asdfasdf</div> <br><br><br> <div class="logRegSite3Text">asdfasdf</div> <br><br> <div id="blackBG"> <a href="./login.php" class="myButtonLOG">Zaloguj si臋</a> <a href="./register.php" class="myButtonREG">Zarejestruj si臋</a> </div> <br><br><br> <table class="horizontalCenter"> <thead> <tr> <th colspan="3" class="logRegSite3Text">Rejestrowanie</th> </tr> </thead> <tbody> <form action="registerFinal.php" method="post"><!-- ten fragment inputow jest wysylany submitem do pliku registerFinal.php --> <tr class="logRegSiteTextBox"> <td>login: </td> <td><input type="text" placeholder="tak" title="nie" required></td> </tr> <tr class="logRegSiteTextBox"> <td>e-mail: </td> <td><input type="text" placeholder="tak" title="nie" required></td> </tr> <tr class="logRegSiteTextBox"> <td>has艂o: </td> <td><input type="password" placeholder="tak" title="nie" required></td> </tr> <tr class="logRegSiteTextBox"> <td>powt贸rz has艂o: </td> <td><input type="password" placeholder="tak" title="nie" required></td> </tr> <tr> <td></td> <td><input type="submit" value="Zarejestruj si臋" class="myButtonREG"></td> </tr> </form> </tbody> </table> </div> </main> </body> </html> The registerFinal.php looks like that: <?php require("connect.php"); $REGlogin = $_POST['loginREGfield']; $REGemail = $_POST['emailREGfield']; $REGpassword = $_POST['passwordREGfield']; $sql = "INSERT INTO users(users_id, users_username, users_password, users_email, users_galaxy, users_starsystem, users_planet, users_planetid) VALUES ('','$REGlogin','$REGpassword','$REGemail','','','','')"; $result = $conn->query($sql); ?> And the connect.php looks like this: <?php $conn = mysqli_connect( 'localhost', 'xxx', 'xxx', 'xxx' ); ?> I really don't know what to do... Backups doesn't helps... even database backups
  11. Hello. I was building my first site and I've already done login and register forms. Then I've finished register form to send new records to the database and it was working. Every time I've filled register form, it was adding new records to the "users" table in my database. Then I was trying to finish login and make sessions, but the problem appeared. I don't know if it's caused by database new column I've added to the users table, or because of the code in my scripts, but now every time I'm trying to send filled registration form it displays this strange error. I was trying to step back by sending my working backup files back to the server, didn't helped. I've also removed these new columns from users table, didn't helped. I've deleted all tables and imported from working backup. Still nothing, same error. What is happening? I got 7 php scripts, I don't know which one should I share
  12. mac_gyver Aaa okay, thanks for explaining :), great I know more and more. You know in my country on Polish forum about PHP only few people answered me to learn basics instead of teaching me like you all here. You're best guys, thanks. It was always my dream to make my own game in a style of OGame, since I've registered to old OGame many years ago. Now dreams became true step by step. Breathtaking hah
  13. Barand thank you sooo much, finally I can continue :D. But I'm curious why there's "u" and "p". I was trying to understand that JOIN, but I didnt get that. benanamen I know I know, for now Im just testing that. Thank you for warning and tutorial, for sure I'll learn that
  14. Hello. Im just starting my adventure with PHP and SQL. I was making the "galaxy view" in the form of table on my test site, that looks like this right now. My code looks like this: <?php $testowanaGalaktyka = 1; $testowanySystem = 1; $testowanaPlaneta = 1; $testowanyGracz = -1; $sql = "SELECT planets_ownerid FROM planets WHERE planets_galaxy = $testowanaGalaktyka AND planets_starsystem = $testowanySystem AND planets_planet = $testowanaPlaneta"; $testowanyGracz = array($row["planets_ownerid"]); $result = $conn->query($sql); if($result->num_rows>0) { while($row = $result->fetch_assoc()) { echo '<b>'.$row["planets_ownerid"]."</b>"; } } else { echo '<p style="color:red;"></p>'; } $conn->close(); ?> And in that one empty field (on the first screenshot) this code displays only "1", which is the planet owner ID (player) in the table "planets" in a row called "planets_ownerid". I want to take that "1" and use it to search in the second table called "users" in the row called "users_id" same ID number and I want to take username (Leopold in this case) in same line from the row called "users_username". How can I make it? This is how my "users" table, and "planets" table looks like.
×
×
  • 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.