Noxin
-
Posts
10 -
Joined
-
Last visited
Posts posted by Noxin
-
-
You are getting that notice because there is no variable defined called $user. You do have a variable called $_user though
Hahaha thank you lets see if this works now
-
<?phpif(isset($_POST['submit'])){$_user=$_POST['user'];}if(isset($_POST['submit'])){$password=$_POST['password'];}if ($user&&$password){$connect = mysql_connect("*******************************Secret Password Stuff****************************") or Die("Could not Connect");mysql_select_db("users") or Die ("Could not find DB");}elsedie ("Data Base Is dead we still have a Problem");?>This is the error code:
Notice: Undefined variable: user in C:\Users\RoSeAnN\Desktop\Web Designing\server\htdocs\connectionphp.php on line 9
Data Base Is dead we still have a ProblemAnd Html... if you need it<html><form action='connectionphp.php' method='POST' accept-charset='UTF-8'>Username:<input type='text' name='user'>Password:<input type='password' name='password'><input type='submit' value='Log in'></form></html>so what am I not doing wrong here and how can i make it work??? All help is much appreciated Thank you! -
Did you see Ch0cu3r reply? It should fix your code.
The following should work (note the semi-colon after the second echo):
Yes I did. It solved the problem eventually.
How ever reading a piece of code that worked straight away was much more helpfull,
Because of that help I have moved on today a lot and now understand PHP better.
But thank you to everyone who posted it has all helped!! I'm sure I'm going to be back with some more noob stuff soon.
-
Good news is usually PHP provides more guidance regarding errors.
Bad news is when you are just starting off, you will get a bunch of these.
At first, try to keep your echo's small and don't mix single and double quotes. I always "just because" put parenthesis around the stuff I want to echo. Know that a semicolon is "mostly" end of command, and keep an eye out for them. Use a dot (.) to join stuff.
<?php $myname = 'Noxin'; echo '<p>This is PHP</p>'. "<p>My name is $myname</p>". '<p>My name in another notation is still '.$myname.'</p>'; ?>
PS. See http://php.net/manual/en/language.types.string.php
Also, I would probably use the following even though the curly brackets are not required:
echo("<p>This is PHP</p><p>My name is {$myname}</p><p>My name in another notation is still {$myname}</p>");
Thanks for this line of code but what made this work???
Its nice to know that php and mysql are working as they should on my system
I think this Forum should make some newbie challenges that are easy to solve for you pro's, But challenging for beginners.
The stuff on the web in just un-accurate and with no one there to help you figure the problems out its near impossible to get your head around.
Thank you for this problem solve Im going to sit and compare the two codes now and try to understand where I went wrong.
-
@Noxin the original code you posted in line 1 was fine the problem was with the word and on line 3. All you needed to was remove that word and this would of solved the error.
and is a logical operator they should only be in control structures, ie when comparing values
ok did just that still got a error on line 7 code stands at:
<?php$myname = 'Noxin';echo '<p>This is PHP</p>';echo "<p>My name is $myname</p>"echo '<p>My name in another notation is still '.$myname.'</p>';?>ERROR isParse error: syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ';' in C:\Users\RoSeAnN\Desktop\Web Designing\server\htdocs\Practice.php on line 7Do I just delete the echo??? -
LoL final reply to my own post tonight
code is this
<?php$myname = 'Noxin';echo'<p>This is PHP</p>';"<p>My name is $myname</p>"'<p>My name in another notation is still '.$myname.'</p>';?>new error
Parse error: syntax error, unexpected ''<p>My name in another notatio' (T_CONSTANT_ENCAPSED_STRING) in C:\Users\RoSeAnN\Desktop\Web Designing\server\htdocs\Practice.php on line 7
-
Boooo!
ok so ive solved some of the issues but the new problem is dosent show everything I Wish it to show this is the new layout;
<?php$myname = 'Noxin';echo'<p>This is PHP</p>';"<p>My name is $myname</p>";'<p>My name in another notation is still '.$myname.'</p>';?>and this is all that shows on the localhost page
This is PHP
how to get the rest of the code to come out?
-
Sorry resolved line 3 issue changed line 3 to echo.
now the problem is line 4
Parse error: syntax error, unexpected 'echo' (T_ECHO) in C:\Users\RoSeAnN\Desktop\Web Designing\server\htdocs\Practice.php on line 4
-
I was reading how to do some beginner stuff in PHP so this to you guys is easy right?
Why dosent the code work properly? And or am I trying stuff that is to advanced for a total noob??
this is the php code from the tutorial:
<?php$myname = 'Noxin';andecho '<p>This is PHP</p>';echo "<p>My name is $myname</p>"echo '<p>My name in another notation is still '.$myname.'</p>';?>This is what appears on my localhost:Parse error: syntax error, unexpected 'and' (T_LOGICAL_AND) in C:\Users\RoSeAnN\Desktop\Web Designing\server\htdocs\Practice.php on line 3 -
Cool will do, could you advise on where I could get or learne more code to do with php in genral as like a php college manuel that students may use when learning and or specifically up to version 5.6.3
-
Id like to introduce myself as Noxin, I came into building sites earlier this year I've completed several sites as training so far.
Each time learning and expanding my knowledge my latest site I have half completed easily, I think people in the industry would say I've completed the front end.
But this time I'm adding login's registration and payment systems I think this is know as the back end of a site.
I came to this site because I really need some help from people who really knows PHP.
So I've been on google and youtube trying to pick up as much knowledge as I could to self teach myself, but the things people say to type in for example: I'd like to give a example but I'm not home yet. But a error will come back on my xammp server as a error on line 4 or something.
So I don't know if php code changes for the different patches that comes out or something or if the stuff people have been saying to type is wrong.
All I know is I'm using notepad++ and I have xammp with php 5.6.3
Any help would be fantastic and sorry for the long intro.
Noxin
Line error
in PHP Coding Help
Posted
So if what you say is right which I assume it is is the code you present me, the right way to write the document??
Also May I have your permission to use it please!