unexpected error

swirly

Active Member
Messages
1,930
Reaction score
0
Points
36
ok for my site im trying to make a script for people to register and then they can therefore log into my site... but im getting theis error...could you guys take a look at it? or maybe teel me somewhere i can get a script for this kinda stuff cause im new at php and i need to make something for someone to registerand then it lets them login..

its: www.zerog.x10hosting.com/add_record.php
 

Torch

New Member
Messages
634
Reaction score
0
Points
0
The best solution would be to get a CMS (content management system), since they already have all the functions you likely wanted to make. You have a selection of qite a few of them (ready to install) when you go to Fantastico at your cPanel. I would recommend Drupal, which is very light CMS and the most easly chagable one (you can quite easy make changes to it's coding and add new stuff yourself with a little knowledge). The next good one is Joomla, but for my taste it's too robust.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Can you show some of the script? (Lines 20 - 30 would be nice. :))
 

swirly

Active Member
Messages
1,930
Reaction score
0
Points
36
Code:
<A href="mailto:$conn=@masql_connect("localhost">$conn=@masql_connect("localhost", "swirly", "friends")
                                                                          or die("Err:conn");
      #select the specified database
      $rs = @mysql_select_db("swirlys_user", $conn)
                                                             or die("Err:db")
      #create the query
      $sql="insert into swirlys_info (name, pass, bday, rname, email)
                              values ( $id, \"$pass\", \"$name\", \$email\", \$bday\" )";
               #execute the query

lines 20-30 thanks!
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
How are you outputting this? Is this in an echo, or.. What? It's weird.. Where are your PHP tags?
 

swirly

Active Member
Messages
1,930
Reaction score
0
Points
36
yea umm i am using a php book i bought and sooo.....i used the wrong thing...so umm nvm guys sorry...and bryon, you only asked for lines 20-30 so thats what i gave you there is more before and after...
 

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
it appears your error is here

PHP:
      $rs = @mysql_select_db("swirlys_user", $conn)
                                                             or die("Err:db")

should be

PHP:
      $rs = @mysql_select_db("swirlys_user", $conn)
                                                             or die("Err:db");
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Yea I know you only showed me those lines, but it's weird and doesn't make sense the way you have it. You can't just execute/have functions in an echo construct, and it doesn't look like your escaped the PHP tags..
 

swirly

Active Member
Messages
1,930
Reaction score
0
Points
36
well that was the wrong code i figured out...but now i got the right one...but its not working....its for people to add names and passwords etc..but its not submitting, and i copied it straight out of the book. did i just spell something. heres the code...
Code:
<html>
<head>
<title>Add User</title></head>
<?php
if( (!$firstname) or (!$lastname)
                               or (!$username) or (!$password) )
{
$form ="Please enter all new user details...";
$form.="<for action=\"$PHP_SELF\"";
$form.=" method=\"post\">First Name: ";
$form.="<input type=\"text\" name\"firstname\"";
$form.="value=\"$firstname\"><br>Last Name: ";
$form.="<input type=\"text\" name\"lastname\"";
$form.="value=\"$lastname\"><br>User Name: ";
$form.="<input type=\"text\" name\"username\"";
$form.="value=\"$username\"><br>Password: ";
$form.="<input type=\"text\" name\"password\"";
$form.="value=\"$password\"><br>";
$form.="<input type=\"submit\" value=\"Submit\">";
$form.="</form>";
echo($form);
}
else
{ $conn = @mysql_connect("localhost", "swirlys", "friends")
or die("Could not connect to MYSQL");
$db = @mysql_select_db("swirlys_user", $conn)
or die("could not select database"); 
$sql = "insert into users
(first_name,last_name,user_name,password) values
(\"$firstname\",\"$lastname\",\"$username\",
                               password(\"$password\") )";
$result [EMAIL="=@mysql_query($sql,$conn"]=@mysql_query($sql,$conn[/EMAIL])
or die("Could not execute query");
if($result) {echo("New user $username added"); }
}
?></body</html>
 
Top