Jump to content

atrocious

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by atrocious

  1. Thanks! Its working now after removing the quotes. I know I can use the single update but I tried to modify got random error. Hence I don't want to spend time messing with it so i created another one lol..... can you fix it?
  2. Ok I tried adding the code below. It does update what i want to but its not putting the actual date there but its adding the text "NOW()" in the field lol mysql_query("update application set comment='".mysql_real_escape_string($_POST[comment])."' where `IGN`='".mysql_real_escape_string($_POST[name])."'"); mysql_query("UPDATE application SET userdatetime = '(NOW())' where `name`='".mysql_real_escape_string($_POST[name])."'");
  3. It does add the date and time but it adds it to the new field instead of adding it to the existing field. So what I have to do here is update rather then adding. How do you insert that "NOW()" inside the update thing? anyone?
  4. What do I need to add below to update the current date/time? I have a field in the database called datetime. I tried to use Now() but its not working. <?php $con = mysql_connect("host" , "aaaaa" , "pw"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("aaaaa", $con); mysql_query("update application set comment='".mysql_real_escape_string($_POST[comment])."' where `name`='".mysql_real_escape_string($_POST[name])."'"); /*This is what I tried to add so that i can directly inject the current date/time*/ $sql="INSERT INTO application (datetime) VALUES(NOW())"; mysql_close($con) ?>
  5. Great! It works. Thank you so much!!!!!!!!! but how do i convert the time to PST. Lets say a user from EST injects to the database. I want to be able to see the time in PST.
  6. I tried doing this. Didn't work! lol Correct me. <?php $con = mysql_connect ( "host" , "database1" , "pw" ) or die(mysql_error()); mysql_select_db( "data" ) or die(mysql_error()); $sql="INSERT INTO test11 (name, ip, date) VALUES('$_POST[name]','$_SERVER[REMOTE_ADDR]','(date_default_timezone_get())')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con) ?>
  7. you'll find the Time Zone and the IP of the user/viewer Below is the code I'm using to inject data into the database. Tell me what code should I add into my existing code so that I can inject the data/time to my database. <?php $con = mysql_connect ( "sql.com" , "app" , "pw" ) or die(mysql_error()); mysql_select_db( "newapp" ) or die(mysql_error()); $sql="INSERT INTO tablename (name, address, age, email, comment,ip) VALUES('$_POST[name]','$_POST[address]','$_POST[age]','$_POST[email]','$_POST[comment]','$_SERVER[REMOTE_ADDR]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con) ?>
  8. Thank you. It worked and I'm able to successfully add the users IP to the database and read it as well by populating it to the table. Still trying to figure out how to insert the data and time when user hits the submit button!
  9. Thank you so much. I will look into it now.
  10. Sorry I'm asking so much question in one thread. I want to record the IP-address of the users who submit the form. How do I do that?
  11. Hi Everyone, I am trying to figure out how to insert the current date and time into the database. Scenario: 1) user enter my site and fills up the forum 2) hits the submit button 3) Regardless of the user location I want the time to be stored in the database in PST. Question: Do I need to get an input from the user for time? or can I just use some server time etc? Right now I'm asking them to manually insert the date and time in the textbox which is not that effective Also I have a checkbox in my forums but I always get 0 in the value field when I check the database. I have it setup as (tinyint(1)) in the database using mysql. I think I am doing wrong. Is there a way to require the user to check the button before they hit the "Submit" button? Thank you in advance for the help.
  12. Sweet it worked! YAY!!!!!!! You are awesome! You are awesome! You are awesome! You are awesome! You are awesome! You are awesome! You are awesome! You are awesome!
  13. Samshel so instead of having a link what i did was when the admin enters the page they will see list of all the applicant and at the bottom of the page they will find the text field to enter ign and comment and once they hit submit it should update the comment section for the particular ign. So if they hit the submit button the below php code will be executed. But i am not getting the code to work. Please modify it. Many many many thanks. <?php $con = mysql_connect("host" , "user" , "pw"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("databasename", $con); mysql_query("update tableName set comment='$_POST[comments]', ... where primaryKey='$_POST[ign]'"); mysql_close($con) ?>
  14. Ok here is what i have so far. I am able to read all the fields from the application table. I also have a forum in the bottom where admin can put IGN and comments when they hit submit. Now my issue: Once they hit submit how do i get the particular IGN from the database and be able to write on the comment section? <?php $con = mysql_connect("host" , "database" , "pw"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("databasename", $con); $result = mysql_query("SELECT * FROM application"); echo "<table border='1'> <tr> <th>In game name</th> <th>Rank</th> <th>Age</th> <th>KD</th> <th>Why join us?</th> <th>Previous Clan</th> <th>Hacking history</th> <th>Email</th> <th>Fav map/mode</th> <th>How you heard about us?</th> <th>Reference</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ign'] . "</td>"; echo "<td>" . $row['Rank'] . "</td>"; echo "<td>" . $row['Age'] . "</td>"; echo "<td>" . $row['Kdr'] . "</td>"; echo "<td>" . $row['Whyjoin'] . "</td>"; echo "<td>" . $row['Preclan'] . "</td>"; echo "<td>" . $row['Hack'] . "</td>"; echo "<td>" . $row['Email'] . "</td>"; echo "<td>" . $row['Mapmode'] . "</td>"; echo "<td>" . $row['Reco'] . "</td>"; echo "<td>" . $row['Refer'] . "</td>"; echo "<td>" . $row['Comment'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> <html> <head></head> <title> </title> <body> <html> <head></head> <title> </title> <body> <form id="form1" name="form1" method="post" action=""> <p>Enter IGN to add comments: <input name="ign" type="text" id="ign" /> </p> <p>Enter your comments here:</p> <p> <textarea name="comments" rows=4 cols=48 id="comments"></textarea> </p> <p> <input name="submit" type="submit" id="submit" value="Submit" /> <input type="reset" name="Reset" value="Reset" /> </p> </form> </body> </html>
  15. I am modifying the application for more simplicity. I worked on admin login creating a username and password in mysql and followed a tutorial in book and in youtube nothing worked so i decided to put this admin page in password protected directory so i don't have to do admin login now. So once the admin gets on page he/she should be able to see all the application. It means all the applicants in the table should be listed and read. Now a comment box should be at the bottom of the page where the admin can put a particular IGN and add comments. Samshel can i add an html code where you have commented to say write code here? And will it do the things that i have mentioned above? Once again thank you for your help. thankful to you and the phpfreaks community.
  16. You are fabulous! If you are a girl i will e-kiss you! If you are a guy then thank you so much I haven't tried the code yet but the way it looks i think is gonna work. I will implement that later. Now i have the last part to finish. This is admin login. I don't want to create the register part. I will add username and password by phpmyadmin creating a new table and give it to the admins. Check the admin login page. http://atrocious.comuf.com/admlogin.html Interesting part: When they click submit their username and password will be verified and they will enter a new page where they will be able to see all existing application. Then they can select the particular application and add comments on it. Now i understand how the admin login page and how to extract all the info from the application table (even though dont have the code for it but how do i add info to that particular application? or in other words how do i add more stuff to the existing table. this is tough for me. Your help will be greatly appreciated. Thank you php freaks this is such a nice platform to learn.
  17. I need help guys, How do I exactly find what I am looking for in the checking status code. It displays the whole table. What I want is to make a query for the particular key entered by the user if that exists return the value if it does not then give an error saying it don't exist.
  18. I think I need an if statement there looking for the IGN that the person is entering but i dont know how do i write that....
  19. it really does not matter who is looking at the page in this context. Since it is the user but in admin page i will have the login functionality. but for this one all it does is displays everthing stored in that table. i only want their IGN and a comment field being displayed... can anyone modify the code ?
  20. Ok so i am working on part © now once after the user submits the application he/she comes back to check his/her status. The key here is ign or (in game name) I wrote a code but it will display everything that's stored in that table. Here is the code. <?php $con = mysql_connect("host" , "database" , "pw"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("databasename", $con); $result = mysql_query("SELECT * FROM application"); echo "<table border='1'> <tr> <th>In Game Name</th> <th>Comments:</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ign'] . "</td>"; echo "<td>" . $row['comment'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  21. Ok great! Now i can see that in the table..... Phew took 5 hours thanks for saving the day. There is the check box at the bottom of my forums now how do i know if they checked or unchecked the box from the phpmyadmin. I think i list that its as BOOL in phpmyadmin. The value I get is 0 in that box. Now can you please give me a heads up on getting started on step (b) and © please.
  22. You are awesome!!!! That definitely worked and i got the echo message printed out. When i looked up in phpmyadmin it says 1 query made today. But i dont see the text that i inserted in the forums? Any idea what might be going wrong?
×
×
  • 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.