Jump to content

Phty5h

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Phty5h's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for all the help guys, Been busy networking my offices these last few days.... but im retty much back to the code now (phew)..... Im about to start trying to build a membership system from scratch for my new business' website, so im pretty certain that im gonna have lots of questions over the next week or so. Thanks again to everyone who's helped so far.... and keep an eye out for a new thread ill start for the membership system. Many Thanks
  2. I just read the forum statment at mysqlfreaks.com *Phty5h muttters Some people really piss me off, skiddies and there childish behavour ruin our ability to share and aquire knowledge. I for one think its disgusting that there are such people out there who get there kicks out of destroying a community based on helping people.... FFs get a date ! thats my rant over to be honest......
  3. [me=Phty5h]dances around like a chimpanzee drunk on laudenum[/me] I did it !!! I managed to get the origional script to work  ;D ;D heres the code im using: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>form.php</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <? $connect = mysql_connect('localhost', "???????", "???????") or die ('Could Not Connect: ' . mysql_error()); echo '<b>Step 1 :</b> Connected Successfully! <br>'; $db = 'mydatabase'; mysql_select_db($db) or die('Could Not Select Database ('.$db.') Because of: '.mysql_error()); echo '<b>Step 2:</b> Connection to ('.$db.') successful!<BR>'; $textfield = $_POST['firstname']; $textfield2 = $_POST['surname']; // for not until you can get to where you can pass them straight into, you have to understand how the queries work first. name which has 3 fields : ID, First & Second $insert = "INSERT INTO name (first, second) VALUES ('$textfield', '$textfield2')"; mysql_query($insert); mysql_close($connect); ?> <form name="form1" id="form1" method="post" action="form.php">        <p>First Name     <input type="text" name="firstname" /> </p>   <p>Surname     <input type="text" name="surname" /> </p>   <p>     <input type="submit" name="Submit" value="Submit" />   </p> </form> </body> </html>[/code] Thank you so much guys, there is no way on earth i could have got this far without you ........ i have a lot further i need to go with this yet. But for now, i still cant get the script that businessman provided to work, i think it would improve my understanding if you could help me fix that one .... as it seems to be a little more advanced than the one ive managed to get going. Hope to hear from you soon. And thanks again  ;D
  4. Sorry guys, ive been playing with this all morning, and im getting no where. In fact, the problem only seems to get worse, heres the code for reference; [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>forumsugest.php</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <? if (isset($formsubmit)) { $connect = mysql_connect("localhost", "???????", "???????");  //passwords ommitted $selectdb = mysql_select_db("mydatabase"); if (!connect || !selectdb) { echo "There was an error connecting to, or select the database"; echo mysql_error(); // remove this after you get it working properly } $textfield = $_POST['firstname']; $textfield2 = $_POST['surname']; $insert = "INSERT INTO name(first, second) VALUES ('$textfield', '$textfield2')"; if ($query = mysql_query($insert)) { echo "The data was inserted into the database correctly"; }else { echo mysql_error(); // take this out when it starts working. echo "There was a problem inserting the data into the database";   } } ?> <form method="insert" action="forumsugest.php">        <p>First Name     <input type="text" name="firstname" /> </p>   <p>Surname     <input type="text" name="surname" /> </p>   <p>     <input type="submit" name="formsubmit" value="Submit" />   </p> </form> </body> </html>[/code] Now when i run that, i get a window that displays my two text fields, when i enter text into the form and click submit the form seems to just refresh, when i check the database in phpmyadmin i cannot see any change.... and so can only assume that it is not working. Ive played with it alot this morning, and one of the things i noticed is very odd.... as you can see from above the database im trying to connect to is called "mydatabase" which i created in phpmyadmin.... however ....... If i change the name of the database to : [code]$selectdb = mysql_select_db("fakedatabase");[/code] where fakedatabase is none existant, the strange thing is that it doesnt seem to make any difference at all.... the same happens as when i have the actual database name in there. Ive tried putting the form tags within the <?...?> tags,  but this gave me an error. then i tried putting the php segmant within the form tags... and this works exactly as ive explained the above code works. Im really confused and feel that everything i thought i acheived yesterday was just bullshit ......... i spent nearly 18 hours on this yesterday, and now i find out that it isnt even doing what i thoguht it was doing. As i type this ive just checked and prooved that i havnt even connected to a database. i went to my other script, and put a made up name into the database connect bit, and it makes no difference. I'm left with the worrying possibility that the problem lies with my actual database, and maybe that im not using phpmyadmin properly. is there something im meant to do after i create my database in phpmyadmin? do i need to export it?... or put the sql somewhere?
  5. [quote author=fenway link=topic=101799.msg403504#msg403504 date=1153868930] Well, perhaps businessman332211 can help you out... I can't really jump in and debug his code at this point. [/quote] Hopefully i'll figure it out myself...... you 2 guys have been amazing so far... especially businessman. Its past midnight here now... and ive been on this since 9am ..... not a bad days work considering i didnt even know how to create a database this morning. I'm gonna get some shut eye, and ponder the situation, and hopefully ill be able to move forward in the morning when im refreshed, my mind is goo at the moment tbh. I'll post tomorrow and let you know how i progress.... or, more likley to beg for some more of your assistance =P Thanks again guys, i feel like im moving forward at last.
  6. then i dont understand why this doesnt seem to work.... i must be missing something .... i understand what its doing... and logically this should work.
  7. that seems to work better. but ... i dont get a confirmation echo'd out that the info has been placed in the database correctly.... it just seems to refresh the screen ..... tbh im not sure how id go about prooving to myself that the info is in the database when it does work... i assume ill be able to see the entries in phpmyadmin somewhere. Am i supposed to be using 2 pages here?.... i have all the code on a single page at the moment? [me=Phty5h]feels stupid[/me]
  8. my other script displays properly, but i still dont think its passing data into the database. when i run your ammended script i get the following now: [code] Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\forumsugest.php on line 12[/code]
  9. ok i replaced my code with the code you just supplied and i get the following error: [code]Parse error: syntax error, unexpected '{' in C:\wamp\www\forumsugest.php on line 10[/code] Allthough if i move the close statement on my origional code to after the query it removes the errors i was recieving, so thanks for that :)
  10. I really do appreciate your help. And i understand the way your trying to help me, it is not good enough for me to simply get it to work without understanding...... but please understand that at 9am this morning i couldnt even create a database in phpmyadmin.... nevermind get my webpage to connect to it correctly. I think i have acheived both of these things today, but in all honesty i could spend the next year playing with that code above and still not get it in the correct place, I understand how the above code works in principle, what i cant do is get it in the right place to work. At the moment my code (the important bit anyway) looks like this; [code]<? $database="mydatabase"; $user="user1"; $password="phobos"; $connect = mysql_connect('localhost', $user, $password) or die ('Could Not Connect: ' . mysql_error()); echo '<b>Step 1 :</b> Connected Successfully! <br>'; $db = 'mydatabase'; mysql_select_db($db) or die('Could Not Select Database ('.$db.') Because of: '.mysql_error()); echo '<b>Step 2:</b> Connected to ('.$db.') successful!<BR>'; mysql_close($connect); $textfield = $_POST['firstname']; $textfield2 = $_POST['surname']; // for not until you can get to where you can pass them straight into, you have to understand how the queries work first. name which has 3 fields : ID, First & Second $insert = "INSERT INTO name (first, second) VALUES $textfield, $textfield2;"; mysql_query($insert);  //This is line 27 ?> <form name="form1" id="form1" method="post" action="">        <p>First Name     <input type="text" name="firstname" /> </p>   <p>Surname     <input type="text" name="surname" /> </p>   <p>     <input type="submit" name="Submit" value="Submit" />   </p> </form>[/code] you can see where ive placed the code you provided, and when it is placed in this position i get connected to the database as before, but with an error on line 27 line 27 is the line that i have commented above. I understand how forms work with php, and have created several using hiddent fields and POST to send the info from multiple pages to an email inbox...... this however seems to work differently, and im afraid i need to ask you for more help. Apoligies for not getting this, and taking up your time ..... i really appreciate it.
  11. thankyou, i really appreciate the help  ;D My form is very simple at the moment... just a  practice one, as you can see from my above code, it has 2 text box's... one for firstname & one for surname, and a submit button. I want to be able to enter a name into the text box's and have that information sent to the relevant fields in my database. Later i will want to create a membership system that will display info that was wentered previously by any given member once they log in. But for now i just need to get these two text fields passing data to the sql database.
  12. that just went straight over my head....... sorry mate ...... i still require a helping hand with this
  13. Thanks for the reply, i think ive just figured it out. I had to change some privlage's settings within phpmyadmin, and include them in the code, my .php file now looks like this: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <? $database="mydatabase"; $user="user10"; $password="password"; $connect = mysql_connect('localhost', $user, $password) or die ('Could Not Connect: ' . mysql_error()); echo '<b>Step 1 :</b> Connected Successfully! <br>'; $db = 'contacts'; mysql_select_db($db) or die('Could Not Select Database ('.$db.') Because of: '.mysql_error()); echo '<b>Step 2:</b> Connected to ('.$db.') successful!<BR>'; mysql_close($connect); ?> <form name="form1" id="form1" method="post" action="">   <p>First Name     <input type="text" name="textfield" /> </p>   <p>Surname     <input type="text" name="textfield2" /> </p>   <p>     <input type="submit" name="Submit" value="Submit" />   </p> </form> </body> </html>[/code] It connects correctly, and displays the form, im now looking at how i get the form to pass information into the database.
  14. Hi guys, i'm in the process of practising with mysql, to try and learn a few things. Ive got wamp installed and have used phpmyadmin to create a database called : mydatabase inside this database i have created a table called : name which has 3 fields : ID, First & Second Id is set to length = 6, auto increment and index, INT The first and second name fields are set to VARCHAR and length 15 I have then loaded Dreamweaver, defined a new site, set the testing server to "C:\wamp\www\" and created a new file called "form.php" At this moment in time form.php looks like this: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <? $database="mydatabase"; mysql_connect(localhost); @mysql_select_db($database) or die( "Unable to select database"); ?> <form name="form1" id="form1" method="post" action="">   <p>First Name     <input type="text" name="textfield" /> </p>   <p>Surname     <input type="text" name="textfield2" /> </p>   <p>     <input type="submit" name="Submit" value="Submit" />   </p> </form> </body> </html>[/code] My first probelm is that when i test this page i get the following error message and i cant figure out why; [code]Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\form.php on line 11 Unable to select database[/code] now i know this is very basic stuff....... but im trying to learn here, and all of your help is appreciated, im sure i will have more problems as i progress, and would like to thank you in advance  ;D
  15. Thanks for your time and help mate......... but i think im even more confused now (if possible). 1) where is all this username info stored? 2) how is it retrieved? 3) how do i get a mysql database that i create at localhost onto my webserver? basic question i know.... but im not even at the code writing stage yet :(
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.