Jump to content

Random

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by Random

  1. Thanks Doc! I just checked it, and it worked like a charm
  2. It was because the variables and the $_POST variables need to be switched... ex. $fname = $_POST[\'f_name\']; thnx anyways
  3. As you can tell from my recent outbreak of posting for newbie help, I am learning MySQL. I am now having trouble with a signup form and the process script. Here they are: SIGNUP FORM: [php:1:78927ec1bf]<?php print \"<BR><BR><BR>\"; print \"<h1>Test for MySQL Tables</h1>\"; print \"<BR><BR><BR>\"; print \'<form action=\"signup_process.php\" method=\"post\">\'; print \'Desired Username: <input type=\"text\" name=\"username\" maxlength=20><BR>\'; print \'Desired Password: <input type=\"password\" name=\"password\" maxlength=20><BR>\'; print \'First Name: <input type=\"text\" name=\"f_name\" maxlength=25><BR>\'; print \'Last Name: <input type=\"text\" name=\"l_name\" maxlength=25><BR>\'; print \'Email Address: <input type=\"text\" name=\"email\" maxlength=\"60\"><BR>\'; print \'Age: <input type=\"text\" name=\"age\" maxlength=\"3\"><BR>\'; print \'Gender: Male<input type=\"radio\" name=\"male\" value=\"male\"> Female<input type=\"radio\" name=\"female\" value=\"female\"><BR>\'; print \'<input type=\"submit\" value=\"Finish signup!\">\'; ?>[/php:1:78927ec1bf] and the PROCESS SCRIPT: [php:1:78927ec1bf]<?php $dbuser = \"random\"; $dbpass = \"random\"; $dbname = \"random\"; $_POST[\'username\'] = $uname; $_POST[\'password\'] = $pword; $_POST[\'f_name\'] = $fname; $_POST[\'$l_name\'] = $lname; $_POST[\'email\'] = $email; $_POST[\'age\'] = $age; $_POST[\'gender\'] = $gender; if (empty($_POST[\'username\']) || ($_POST[\'password\']) || ($_POST[\'f_name\']) || ($_POST[\'l_name\']) || ($_POST[\'email\']) || ($_POST[\'age\']) || ($_POST[\'gender\'])) { print \"Please fill in all of the required fields!\"; }else { $link = mysql_connect(\"localhost\", $dbuser, $dbpass) or die (\"Database Error: Couldn\'t Connect!\"); mysql_select_db($dbname, $link) or die (\"Couldn\'t open $db!\"); $query = \"INSERT INTO user_info (username, password, f_name, l_name, email, age, gender) values( \'$uname\', \'$pword\', \'$fname\', \'$lname\', \'$email\', \'$age\', \'$gender\' )\"; mysql_query($query, $link) or die (\"Couldn\'t input data!\"); mysql_close($link); } ?>[/php:1:78927ec1bf] After I hit the submit button and process the form, no errors come up, so I goto my PuTTY box and get onto my database, select the columns, and they just added blank lines to it, no information what-so-ever. Help please.
  4. still didn\'t work. yeah I will wait for shiva to get on.
  5. [php:1:10dbd8e8ef]<?php $fetch = @mysql_fetch_row( $result ); ?>[/php:1:10dbd8e8ef] so it looks like that? if so that didn\'t work.
  6. I was just pointing out why it says connected that wasnt a problem hehe
  7. How do I print a row from mysql? This is the script I was trying ( newbie at this ): [php:1:71284b16c1]<?php print \"<BR><BR><BR><BR>\"; $conn = mysql_connect(\"localhost\", \"random\", \"random\") or die (\"Couldn\'t Connect...\"); print \"Connected!\"; $db = \"random\"; mysql_select_db($db, $conn) or die (\"Couldn\'t connect\"); $result = mysql_query( \"SELECT * FROM user_info \"); $fetch = mysql_fetch_row( $result ); print \" $fetch \"; mysql_close( $conn ); ?> [/php:1:71284b16c1] It prints out: \"Connected! Array\"; where Connected is from the successful connect, and I guess $result is printing Array. Any help is appreciated. Thanks.
  8. ok, i was forgetting the int line. eehhe.
  9. I am using PuTTY to access my mysql database. I want to add a table named users into it with rows named username and password. How would I write this up? I have this but there is a syntax error: mysql> CREATE TABLE users ( username VARCHAR(20), password VARCHAR(20)); thanks
  10. Is there a way to write a PHP script that I just execute that will completely remove everything from a database? Thanks.
  11. update: he told me to use localhost, and it worked to the point of no errors coming up, so I used a or die statement, and it went off. What could it be now? Localhost is right, and my names, etc. is all right. Thanks
  12. can someone explain each part of the table...example: sql = CREATE TABLE test int not null AUTO_INCREMENT, dead VARCHAR(20), live CHAR(1); or whatever, like what does the int, not null, AUTO_INCREMENT, and VARCHAR/CHAR, and the numbers in the parathesis mean? Thanks
  13. He said that the port may not be right..is that a possibility?
  14. im getting this error when I put in the script and changed it around to fit my needs: Warning: mysql_connect() [function.mysql-connect]: Can\'t connect to MySQL server on \'random.travisbsd.no-ip.org\' (60) in /usr/home/random/pubhtml/database.php on line 2 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /usr/home/random/pubhtml/database.php on line 4 here is the script: <?php $db = mysql_connect("random.travisbsd.no-ip.org", "CENSORED","CENSORED"); mysql_select_db("random",$db); $sql = "CREATE TABLE test ( id int(11) NOT NULL auto_increment)"; $result = mysql_query($sql); ?>
  15. Is there a way to print out on a page thruogh a PHP script all of the Databases and Tables in a MySQL server that is under a specific username/password? Thanks in advance
  16. will it display anything, like \"Database Table Successfully Installed\" or something of that sort? And what if i goto that site over and over, it will only make one table, right?
  17. Will this work from a PHP script that I upload and execute in the server, if I just change localhost to the IP/Domain name of the server?
  18. I have no idea, my friend hosts my site he lives in Arkansas, I live in Indiana.
  19. uh please post an example how?
  20. Is there a way to add a table to a database when I do not host the mysql databases? Like through a PHP script? Thanks in advance.
  21. I need to know the line in apache to allow php, php3 and phtml files to be accessed on a local server...feel free to aim/msn me.
  22. ok update. This is what it says now when I try to start apache: (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80. Unable to open log
  23. oh alright lol i wondered so I could make it .randomdesign
×
×
  • 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.