|
2010-03-03, 09:27 PM | #1 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
PHP Scripting question?
For weeks now I have been reading tutorials on PHPmysql and inserting tables into the database. I have almost become obsessed with wanting to understand the concepts of php. I am determined to get this mastered to some degree. So here below I have a simple register/loging script that I am just trying to understand the basics of getting this functional for now. I have inserted the following simple table ino my database and I am having trouble getting the register.php and login.php to be reconized in the database. Below I have put XXXXX's to where I presume I am to be insert my info.
Can someone plz help me by indicating wither or not I have this correct as to where I have put the X's ??? If anyone is interested in the actual link, it is as follows: http://www.detailzusedcars.com/us-au...4/register.php PHP Code:
Di' Vad |
2010-03-03, 10:38 PM | #2 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
I'm really not a php expert, so it's hard for me to look at the code you have and see the problem.
That said, I've written some simple registration type forms. From the way I understand your question, you are trying to put the actual data where you have the xxxxx? Like $_POST('xxxxx') would be $_POST('mark6188')? You don't put the data in the $_Post. You put the variable name. So in your input form you would put the field 'user' and in the database it's called 'username'. Hence you would set up the form with <input type="text" name="user" id="user" /> <input type="text" name="pw" id="pw" /> let's say I put in your form where user=mark6188 and pw=abc123 Then do the insert query $q = "insert into dbUser ('username', 'password') values ($_POST['user'], $_POST['pw'] )"; not sure if I have all the quotes and double quotes right, but the above should insert the correct values into your table. If I misunderstood your question, please restate it and I'll try again. Hope that helps.
__________________
My Blog: Working The Business |
2010-03-04, 11:34 AM | #3 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Thanks for your response Mark...
Quote:
Good Morning Mark and thankyou for responding. I was replying to what you said whe you were on line earlier and hit enter to move down a line. And my browser closed right out on me. so I am sorry I missed you. If I am to understand you correctly. You are inplying that I should be adding a form as you have indicated in the above statement. However this script was written in such a way to only reconize one database user for the time being. so that is what I am trying to get it to do. The tutorial is here: http://www.trap17.com/index.php/php-...ial_t7887.html I understand if you don't have time to check this simple formated script out. But I am sure that if you were to check it out it would be esy for you to see what it is that needs to be done. I get what your getting at above though and it makes sense to me. But I just don't know if its necessary to be adding this form outside of what the sites is giving driection to be doing to have it work porperly. Soner or later it will click in my dense head. I am on some heavy meds just now for a herniated disc I am having removed on the 19th of this months. so I am in a fog with my thinking. But it will hit me out of the blue as to what I am doing wrong upto this point. Thanks again! |
|
2010-03-04, 11:39 AM | #4 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Also Mark I think the missing element might have to do with what it says here in this part of the script at the bottom:
Quote:
--------------------------------------- Just exactly what the variable is-is something I am not understanding. what is the variable as you were implying??? Last edited by DIVAD3; 2010-03-04 at 11:42 AM.. |
|
2010-03-04, 12:22 PM | #5 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
I can see now, that you were not telling me to add anything new! You were reffering to what is already a part of the script. Da Da Di'vad
|
2010-03-04, 12:24 PM | #6 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
No, you don't need to add a form, basically the form is already in the code.
Code:
//The web form for input ability else { echo "<form action=\"?op=reg\" method=\"POST\">\n"; echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n"; echo "Password: <input type=\"password\" name=\"password\" MAXLENGTH=\"16\"><br />\n"; echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br />\n"; echo "<input type=\"submit\">\n"; echo "</form>\n"; } Code:
// Fields are clear, add user to database // Setup query $q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) " . "VALUES ('".$_POST["username"]."', " ."PASSWORD('".$_POST["password"]."'), " . "'".$_POST["email"]."')"; Honestly, I'm still not sure what your question is. When I click on your link, I see a "Error Connecting to Database" message. Is this what you need help with? If so, you don't want to touch any of the code with the form in it. You need to modify the dbConfig.php file and put your username and password for the mysql database you setup. Code:
<? // Replace the variable values below // with your specific database information. $host = "localhost"; $user = "UserName"; $pass = "Password"; $db = "dbName"; Code:
<? // Replace the variable values below // with your specific database information. $host = "localhost"; $user = "hostname_dvad3"; $pass = "abc123"; $db = "hostname_dbName";
__________________
My Blog: Working The Business Last edited by mark6188; 2010-03-04 at 12:27 PM.. |
2010-03-04, 12:30 PM | #7 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
3 scripts Unscathed!
Here is the entire 3 scripts unscathed by me Mark. If you could just quote them and put in the XXX's or indicate by any terms, where I am to insert what is neccessary. I think I might crasp things a little bit better. I can't promise that however! At least that way I can just make the comparison
Quote:
|
|
2010-03-04, 12:35 PM | #8 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Quote:
And I was just putting the xxx's as to fill it in with something. |
|
2010-03-04, 12:40 PM | #9 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Mark here is what I have on line right now. This might help you understand completel what I have wrong.
Quote:
|
|
2010-03-04, 12:50 PM | #10 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Here I see where I should have it as = local host and not my entire server host name. so thats one area corrected now.
|
2010-03-04, 01:00 PM | #11 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Ok after reading ALL that you are indicating. I believe I understand completely what I have done wrong. so here is what I have done for changes.
register.php Quote:
PHP Code:
PHP Code:
Last edited by DIVAD3; 2010-03-04 at 01:04 PM.. |
|
2010-03-04, 01:07 PM | #12 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Thankyou EXTREAMLY for taking the time to help me understand all this! I wil lfigure out a clever idea to help promote what you got going on
So now I'll upload that to the server. Or in my case drag and drop into the ftphost browser window. Last edited by DIVAD3; 2010-03-04 at 01:09 PM.. |
2010-03-04, 01:18 PM | #13 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
AGGREVATING...
AGGREVATING: Login No such luck. What the Fuk do I have wrong???
I should be able to log in using the username of:admblogdetailzus And the password of:OLIVIAlynn616 And Mark! I am not sure why I see the: (Error connecting to database) on the login page. That too is a mystry to me. Anyone is welcome to try this login: http://www.detailzusedcars.com/us-auto-deal4/login.php Good lord. This means money in my pocket when I get this figured out for the purpose of this site I have built. http://www.detailzusedcars.com/us-au...l/register.php Just as it is put in the script: Quote:
Last edited by DIVAD3; 2010-03-04 at 01:32 PM.. |
|
2010-03-04, 01:28 PM | #14 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Did I create the query correctly???
Quote:
|
|
2010-03-04, 01:59 PM | #15 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
I'm at my day job, so I can only look at this in brief spurts. Right now I see this is wrong:
if (!$_POST["admblogdetailzus"] || !$_POST["OLIVIAlynn616"]) should be: if (!$_POST["username"] || !$_POST["password"])
__________________
My Blog: Working The Business |
2010-03-04, 02:14 PM | #16 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Ok - I do appreciate ur help Mark...
Quote:
PHP Code:
Last edited by DIVAD3; 2010-03-04 at 02:27 PM.. |
|
2010-03-04, 02:32 PM | #17 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
I am questioning this part of things as well. Because I don't understand why I have nothing stated as far as a email would be concerned if I am having the values and password indicating something. The actual Register php page has a place for an entry of a email.
http://www.detailzusedcars.com/us-au...4/register.php and this page also indicated a failure to connect to database as the login page does. This is from the register.php: Quote:
Last edited by DIVAD3; 2010-03-04 at 02:49 PM.. |
|
2010-03-04, 04:57 PM | #18 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
the username and database name almost always have a prefix that I'm not seeing in your code.
Usually it's the sign in ID to create a mysql database. So if I sign into my host with 'malexander' then my username would be 'malexander_admblogdetailzus'. The database name would be 'malexander_dbuser'. Hence you would write $user="malexander_admblogdetailzus"; $db="malexander_dbuser";
__________________
My Blog: Working The Business |
2010-03-04, 05:14 PM | #19 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
UM....
Quote:
Um - This has me baffled by what your saying. I am addressing this matter to you in a PM. Plz C Ur Mail Mark. After you read ur mail you might begin to see that I just might be confusing the whole database system. I don't know for sure. But I am thinking this due to how I named things in setting up the script. And pehpas the simple solution would be to just rename things in the script as for username and password are concernd. In Looking at my notes of how I set things up. I cannot find anything similiar to how you are discribing things. However I am probably overlooking the simplicity of what your saying. When I set up the database in mysql. I gave it a hostname of: mysqldb2.ehost-services.com / Also noted here is: Protocal version: 10 MYSQL charset:UTF-8 unicode USER: divad3@69.156.200 (i assume its a IP Address) But it isnt mine on my pc. blah blah blah ..webserver info and phpmyadmin - version information 3.1.5.. Originally when I first got involved with learning to create a table. I had created a table called divad3_admin. But that table was unsuccessful because when I went to save it. I had gotten logged off from the host for having one window to many open at the same time I was working in the database. So it wasn't saved. And the database of admblogdetailzus was a suggested name. Due to the ones I was trying to have wasnt being accepted. Last edited by DIVAD3; 2010-03-04 at 06:00 PM.. |
|
2010-03-04, 09:10 PM | #20 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Just got home, I'll take a quick look.
__________________
My Blog: Working The Business |
2010-03-04, 11:04 PM | #21 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Okay, fixed the database error and was able to add a new user.
You had several syntax errors - particularly quotes and double quotes- just too many to mention. (note: when you copy code from a website - watch the single and double quotes - you often have to replace them with the correct quote - difficult to explain but look at the quotes around this variable - `username` -need to change the quotes to 'username'. You also selected the wrong table - dbUser instead of dbuser. The table itself had errors in how you named the fields. You put a single quote around each one like 'username' when you should just put in username. The php server was not on the same host as your database, so you have to point to the correct host and not "localhost" in the dbConfig.php file. Another not so obvious fix was the password itself - I had to run a simple password query to make the password work. SETPASSWORD = OLD_PASSWORD('OLIVIAlynn616'); There are still some problems with the "Input vaildation" section of code as it doesn't detect when I leave a field blank. I added some code and rewrote some of the other stuff to be clearer on what's going on and what's passing around. I also added the mysql_error() function to help diagnose some of the problems. you should use this everywhere - it's helps a lot. That's about all I can do tonight, really tired. But you are up and running more or less. If you still have trouble, I'll try and help you out tomorrow.
__________________
My Blog: Working The Business Last edited by mark6188; 2010-03-04 at 11:10 PM.. |
2010-03-04, 11:43 PM | #22 | |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Quote:
Good night Mark and thanks again! ttyl |
|
2010-03-05, 12:40 AM | #23 |
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
Hi Mark! I went to the register php url and registered a user name of agnew95 gave it a password of oliver and my email of davidsabode@yahoo.com / It worked and brought up a page THANKS FOR REGISTERING. Then I went to the login php. using the same info that was just registered and the result was a page saying: Sorry, could not log you in. Wrong login information.
Ok so now I am just looking inside your work at the configuration php And I see that I did need to use this: host = 'admblogdetailzus.db.3474803.hostedresource.com / including the dot com. After checking the login php I have trryed to log in with the username and password as indicated in the php file. The result was the same: Wrong login information. Hey I am happy to see at least the register php file is working. I am elated indeed. Thank you Mark ! I must call it a night. Its after midnight here in NY 12:45 to be exact. TTYL Have a good nights rest Mark! Di' Vad Last edited by DIVAD3; 2010-03-05 at 12:43 AM.. |
2010-03-05, 12:27 PM | #24 | ||
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
|
So if I am to understand this correctly, things like the following are double quotations:
Quote:
Quote:
------------------------- Time Lapse: Ok I think this site is giving me a handle on those matters...http://stackoverflow.com/questions/2...ome-so-popular Last edited by DIVAD3; 2010-03-05 at 12:43 PM.. |
||
|
|