Jump to content

registration php


RaRa3

Recommended Posts

hello so i am making a registration page using html and php, i need to make the information send to mysql that i made with table but i never made select statements..i am not sure on how to make it i need help i am new to this so please bare with me. So I this code to connect to mysql

none

I am not sure how to fix it i know there must be a problem with the code for the submit line and with the isset. I got them from another user but made minor changes to fit my database. My database has 2 tables one named UserAccount with the information listed in the registration page and then another table named Cart for purchases to be made.

 

Please if you can help me with my code or if you see other errors i think i might have an error with my php where i put firstName, and etc.

 

 

and if you know any other material or links that would help me for making product information and a cart send to a database if you can share it, im trying but having many issues

Edited by RaRa3
Link to comment
Share on other sites

It looks like you have an invalid character as your string delimiter, you can see it clearly when the code is highlighted.

 

This is the problem:

include('connect.php);

 

There are other problems, such as the variables names used here:

$conn = mysqli_connect($Shop, $root, $password);
Link to comment
Share on other sites

oh thanks i missed that i dont know why anytime i edit a word in quotations it automatically changes the delimiter, but also i have a question for that line

 

$conn = mysqli_connect($Shop, $root, $password);

 

 

my database name is called shop, and the username is root and the password is a actual password but i put password so i dont reveal it, now do i actually change them to fit the description of the database or put $hostname, $username, $ password ?

 

does the "$" also need to be included?

Link to comment
Share on other sites

The $ indicates a variable, which is explained in the W3Schools PHP tutorial. If you don't want a variable, then you can use a string:

$conn = mysqli_connect('shop', 'root', 'password');

What program are you using to edit your code? If it's converting your single-quotes to fancy quotes, then it's clearly not a coding environment you're working in.

Link to comment
Share on other sites

ohhh okay well im using textedit i have a mac, i know i should use netbeans or something but idk i feel comfortable with textedit,

 

now also im getting an error for the connect php file

 

Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Applications/XAMPP/xamppfiles/htdocs/connect.php on line 7Warning: mysqli_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Applications/XAMPP/xamppfiles/htdocs/connect.php on line 7Connection failed: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

Edited by RaRa3
Link to comment
Share on other sites

Actually, the first parameter of the mysqli_connect() function is the name of the database server. It's often "localhost", but might be something else, for example "sql.webhost.com"

 

I suggest you read the whole PHP tutorial so you can understand the concepts more clearly.

Link to comment
Share on other sites

The tutorial does have a MySQL section, but you really need to learn the basics, because your current mistakes are with the core syntax of PHP.

 

localhost is not a function, it's a server name, so you would put it as the first parameter of the mysqli_connect function. Once you learn PHP you should know what "parameter" means and what a function is.

  • Like 1
Link to comment
Share on other sites

Connected successfullyNotice: Undefined index: firstName in /Applications/XAMPP/xamppfiles/htdocs/register.php on line 7please fill the empty field.

 

i fixed it and got connected successfully but i still dont see an error in that line..idk

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...