Jump to content
Sign in to follow this  
RaRa3

registration php

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

Share this post


Link to post
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);

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

should the line look like this?

$conn = localhost(‘Shop','root','password');

 

thanks im going to read about it now

does it mention about how sql works with php?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I would suggest learning about SQL injection. Otherwise, your site is very open to hacking.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...