/    Sign up×
Community /Pin to ProfileBookmark

ok. just got back from being bedridden for 2 weeks.. (uhg. hate bein sick. got hit way to hard.) and i am back to this issue:

mysql and php… a match made in hell.(well not really but i cant get it to work.)

i get free SQL hosting and i have a php host too. so heres the page: register.html and register.php

register.html

[code] <form action=”register.php” method=”POST”>
<p class=”MainText” style=”text-align:center;”>Username: <input type=”text” name=”username” size=”11″ /><br /> &nbsp;Password: <input type=”password” name=”password” size=”11″ /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Email: <input type=”text” name=”email” size=”11″ /><br /></p>
<p class=”MainText” style=”text-align:center;”><input class=”Submit” type=”submit” value=”Submit” /></p>
</form>[/code]

and register.php

[code]<?php

$username = “$_POST[‘username’]”;
$password = “$_POST[‘password’]”;
$email = “$_POST[’email’]”;

$host = “sorry”;
$dbusername = “sorry”;
$dbpassword = “sorry”;
$database = “sorry”;

$signup = “INSERT INTO Users (id, created, username, userpass, email) VALUES (”, NOW(), ‘$username’, ‘$password’, ‘$email’)”;
$test = “INSERT INTO `Users` (`id`, `created`, `username`, `userpass`, `email`) VALUES (”, ‘666’, ‘xaxei’, ‘pass’, ‘[email protected]’)”;
$create = “CREATE TABLE `test` (`bob` TINYINT NOT NULL )”;

mysql_connect($host, $username, $password);
mysql_select_db($database);
mysql_query($test);
mysql_close();

echo “Username: ” $_POST[‘username’];<br />
echo “Password: ” $_POST[‘password’];<br />
echo “Email: ” $email;<br />
?>[/code]

pyro I don’t see why this wont work. its annoying me. if i tell it to do $test it wont work, $create wont work and $signup wont work so im confused. it must be something stupid and im sure you’ll be able to tell me what it is! (please?) its really annoying me 😑 … anyone else can help too=P
also, i use phpmyadmin to check the database and i can give u all the passwords and information if u need to fix this cause i have no clue why it wont work and iv been working on it for a while and with this on top of being sick i just want to give up!

much thanks in advance

to post a comment
PHP

16 Comments(s) ↴

Copy linkTweet thisAlerts:
@Khalid_AliDec 23.2003 β€”Β you did not say that if you are getting any values from the form at all?..
Copy linkTweet thisAlerts:
@pyroDec 24.2003 β€”Β You've got several errors (that I notice just by taking a quick glance - perhaps there are others).

The first three lines and the last three lines of code.

The $_POST variables should not be contained in double quotes. Remove them, and that will be better.

And, at the bottom, you need to pass the values to your echo construct a bit differently. Try this:

[code=php]echo "Username: ".$_POST['username']."<br />"; # did you mean to use $_POST for this one
echo "Password: ".$_POST['password']."<br />"; # and this one
echo "Email: ".$email."<br />"; # but not this one?[/code]
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzauthorDec 24.2003 β€”Β ty much pyro for the tip about the quotes. and the echo works now... but the stupid database still won't work.
Copy linkTweet thisAlerts:
@pyroDec 24.2003 β€”Β Is the table Users capitalized? Or, are you getting any errors?
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzauthorDec 24.2003 β€”Β yes. Users is how it is in the database. Ima PM you some details and see if you can see whats wrong.
Copy linkTweet thisAlerts:
@pyroDec 24.2003 β€”Β Ok, I'll take a look at it later. Right now, I'm going to go snowblow off our ice rink. ?
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzauthorDec 25.2003 β€”Β you ok pyro? you didnt die in a horrible ice skating accident did ya?
Copy linkTweet thisAlerts:
@Paul_JrDec 25.2003 β€”Β [i]Originally posted by Sux0rZh@jc0rz [/i]

[B]you ok pyro? you didnt die in a horrible ice skating accident did ya? [/B][/QUOTE]

Maybe he fell in... it got kinda rainy here, and things melted a bit.
Copy linkTweet thisAlerts:
@pyroDec 26.2003 β€”Β hehe... Still alive and kicking, even after a day of skiing. Wanted to be out on a snowboard, but the rest of the group was on skis, so I was, as well. Gosh, I love winter... :p
Copy linkTweet thisAlerts:
@Paul_JrDec 26.2003 β€”Β [i]Originally posted by pyro [/i]

[B]hehe... Still alive and kicking, even after a day of skiing. Wanted to be out on a snowboard, but the rest of the group was on skis, so I was, as well. Gosh, I love winter... :p [/B][/QUOTE]

Whooo! I love to ski! WOOOO!!!

But snowboarding sucks. :rolleyes:
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzauthorDec 26.2003 β€”Β k pyro. i revamped my register.php but i get keep getting a parsing error on line 8. know what the problem may be? &lt;?php

$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$created = Now()

$signup = "INSERT INTO <span><code>Users</code></span> (<span><code>id</code></span>, <span><code>created</code></span>, <span><code>username</code></span>, <span><code>userpass</code></span>, <span><code>email</code></span>) VALUES ('', '$created', '$username', '$password', '$email')";
$test = "INSERT INTO <span><code>Users</code></span> (<span><code>id</code></span>, <span><code>created</code></span>, <span><code>username</code></span>, <span><code>userpass</code></span>, <span><code>email</code></span>) VALUES ('', Now(), 'xaxei', 'xaxexi', '[email protected]')";
$create = "CREATE TABLE <span><code>test</code></span> (<span><code>bob</code></span> TINYINT NOT NULL )";

mysql_connect ("localhost", "srry", "srry") or die ("I cannot connect to the database because: " . mysql_error());
mysql_select_db ("srry");
mysql_query($create);
mysql_close();

echo "Username: " . $username . "&lt;br /&gt;";
echo "Password: " . $password . "&lt;br /&gt;";
echo "Email: " . $email . "&lt;br /&gt;";
echo "Created: " . $created . "&lt;br /&gt;";

?&gt;
Copy linkTweet thisAlerts:
@pyroDec 26.2003 β€”Β What error are you getting?
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzauthorDec 26.2003 β€”Β Parse error: parse error in public_html/xaxei/register.php on line 8
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzauthorDec 26.2003 β€”Β duh! omg! i forgot a ; after Now()... god. i spent like 30 minutes trying to figure out what was wrong with line 8 instead of what was missing from line 6. *smacks head*
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzauthorDec 26.2003 β€”Β ok, yay! it all works now. the users are added to the database now. yay!
Copy linkTweet thisAlerts:
@pyroDec 26.2003 β€”Β Yes, I saw that after I posted to tell you to post the error message, but didn't have time to let you know. ?

Anyway, it is always a good idea to look on the line before when you get a parse error.
Γ—

Success!

Help @Sux0rZh_jc0rz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 β€” BETA 5.18,
whats_new: community page,
up_next: more Davinciβ€’003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinciβ€’003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...