Jump to content

Explain nr 3?


eduard

Recommended Posts

What do you mean by ´using the values you submitted´? Where? In phpMyAdmin? Also if I fill in onlu numbers (fpr price and quantity) I get also 0!
Do you remember those two files we were working with before? form.html and script.php? Do you remember how we went through it all with you to get it to print out the description, price, and quantity on the screen after you clicked the submit button? That is the code you need to be working with. We've told you this numerous times. You need to add the INSERT query to your code in script.php just like scientist showed you in this post:
so let's re-write it then. if you do this, what results do you get? and reply with code and any output.note: as mentioned before, this should be integrated into the previous form handling script we've been working on. so let me show you what we mean.
<?phpvar_dump($_POST);if(isset($_POST['price']) && isset($_POST['description']) && isset($_POST['quantity'])){  echo 'successful form submission. initialize DB connection...';   $con = mysql_connect("localhost","root","root");  if (!$con){	die('Could not connect: ' . mysql_error());  };  echo 'connection initialized...';   mysql_select_db("Company", $con);    $sql="INSERT INTO Persons (description, price, quantity) VALUES  ('$_POST[description]','$_POST[price]','$_POST[quantity]')";  echo 'prepare for INSERT: ' . $sql;  if (!mysql_query($sql,$con)){	die('Error: ' . mysql_error());  }else{	echo "1 record added";  };  mysql_close($con);}else{  echo 'one of more form fields missing';};?>

Link to comment
Share on other sites

  • Replies 239
  • Created
  • Last Reply
What do you mean by ´using the values you submitted´? Where? In phpMyAdmin? Also if I fill in onlu numbers (fpr price and quantity) I get also 0!
THE F@#$#@$ FORM!!!!!!!!!!!!what have we been trying to tell you! from post 1.
3a) PHP - create a script that takes in a $_POST or $_GET array for submitting form data to the database* http://www.w3schools.com/php/php_forms.asp* http://www.w3schools.com/php/php_get.asp* http://www.w3schools.com/php/php_post.aspb ) PHP/SQL - once you have the form submitting to the PHP script, and you can view all the data, you are ready to write an INSERT query to submit the information to the database* http://www.w3schools.com/php/php_mysql_insert.asp
everything we've been teaching you in this thread has been revolving around this one concept.1) create a form2) the form submits to a PHP script3) PHP script checks form inputs and creates a SQL query to INSERT form data into the databasedamn. what don't you understand about that!?you've been given complete examples too.edit: sorry, but is anyone else in this thread getting as frustrated as I am?edit edit: sorry for yelling.
Link to comment
Share on other sites

Do you remember those two files we were working with before? form.html and script.php? Do you remember how we went through it all with you to get it to print out the description, price, and quantity on the screen after you clicked the submit button? That is the code you need to be working with. We've told you this numerous times. You need to add the INSERT query to your code in script.php just like scientist showed you in this post:
What about this (I´m getting very tired!):phpMyAdmin - ErrorCannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.P. s. I have the two files!
Link to comment
Share on other sites

and for the record, you're whole complaint about getting too much advice from too many people is really starting to wear thin. You make it seem like one person's trying to tell you why the sky is blue, and another person is trying to tell you it's green. At the most extreme it's like someone's telling you it's blue and another person's telling you it's light blue. The only person making it confusing and harder to understand here is you.

Link to comment
Share on other sites

and for the record, you're whole complaint about getting too much advice from too many people is really starting to wear thin. You make it seem like one person's trying to tell you why the sky is blue, and another person is trying to tell you it's green. At the most extreme it's like someone's telling you it's blue and another person's telling you it's light blue. The only person making it confusing and harder to understand here is you.
The sky is green! Isn´t it?
Link to comment
Share on other sites

Copy this code to a new file and run it in the browser:

<?phperror_reporting(E_ALL);ini_set('html_errors', 1);ini_set('log_errors', 0);ini_set('display_errors', 1);session_start();$_SESSION['test'] = 'test';?>

If that gives you an error, paste it here.

Link to comment
Share on other sites

Seriously scientist give it up, you are going to end up more stressed than this guy claims he is, its a total waste of time, its like working with someone like mister Bean, with a memory span of a goldfish, just sit back, read the posts and l have a stress free laugh at it all. its great!, almost 200 posts and his just managed to read posted data from a form, its hilarious, especially when continuously adding semi colon to end of php code (end curly brackets) for no apparent reason, after been told several times not, ha, ha.

The sky is green! Isn´t it?
HA, he's messing with us, must be.
Link to comment
Share on other sites

Seriously scientist give it up, you are going to end up more stressed than this guy claims he is, its a total waste of time, its like working with someone like mister Bean, with a memory span of a goldfish, just sit back, read the posts and l have a stress free laugh at it all. its great!, almost 200 posts and his just managed to read posted data from a form, its hilarious, especially when continuously adding semi colon to end of php code (end curly brackets) for no apparent reason, after been told several times not, ha, ha.HA, he's messing with us, must be.
I hope for you that you have more interests than just the computer!
Link to comment
Share on other sites

And this?Parse error: syntax error, unexpected T_ECHO in /Applications/MAMP/htdocs/website/script.php on line 21

Link to comment
Share on other sites

All parse errors and syntax errors mean the same thing, they mean your code is not written correctly. That particular message means it found an echo on line 21 that it wasn't expecting. That could be because of a problem on one of the previous lines, like a missing semicolon, missing parenthesis or bracket, etc.

Link to comment
Share on other sites

I hope you wake up to the idea that are never ever going to be a web developer, and as soon as you wake up to that idea the better.
Did I ever write I´m going to be a web developer? So, I don´t have to wake up, because I´m awake (always)!
Link to comment
Share on other sites

All parse errors and syntax errors mean the same thing, they mean your code is not written correctly. That particular message means it found an echo on line 21 that it wasn't expecting. That could be because of a problem on one of the previous lines, like a missing semicolon, missing parenthesis or bracket, etc.
Ok, thanks!
Link to comment
Share on other sites

I don´t get it!Parse error: syntax error, unexpected T_ECHO in /Applications/MAMP/htdocs/website/script.php on line 21<?phpvar_dump($_POST);if(isset($_POST['price']) && isset($_POST['description']) && isset($_POST['quantity'])){ echo 'successful form submission. initialize DB connection...'; $con = mysql_connect("localhost","root","root"); if (!$con){ die('Could not connect: ' . mysql_error()); }; echo 'connection initialized...'; mysql_select_db("Company", $con); $sql="INSERT INTO Persons (description, price, quantity) VALUES ('$_POST[description]','$_POST[price]','$_POST[quantity]')"; echo 'prepare for INSERT: ' . $sql; if (!mysql_query($sql,$con)){ die('Error: ' . mysql_error()); }else{ echo 'one of more form fields missing' }; mysql_close($con);?>

Link to comment
Share on other sites

One problem is that line 21 does not end with a semicolon. Another problem is that the if statement on line 4 has an opening bracket, but no closing one.
Thanks! But that´s also a problem! In some tutorials are echoes written WITHOUT semicolon!
Link to comment
Share on other sites

Did I ever write I´m going to be a web developer? So, I don´t have to wake up, because I´m awake (always)!
Well, I'm pretty sure thats what it said on your website, and anyway you can't be that awake, more like in a coma, AS IN, what do think you have been attempting to learn for the last 6+ months.
Link to comment
Share on other sites

Did I ever write I´m going to be a web developer? So, I don´t have to wake up, because I´m awake (always)!
now you're just outright lying.http://w3schools.invisionzone.com/index.ph...c=36473&hl=http://w3schools.invisionzone.com/index.ph...c=35938&hl=http://w3schools.invisionzone.com/index.ph...c=35996&hl=http://w3schools.invisionzone.com/index.ph...c=35592&hl=I don't what else there is to do for you. you've been given everything you need to accomplish the question you asked in post 1 (albeit 200 posts later...). complete working examples were written for you because you couldn't follow the tutorials. Ironically, what you've been taught is almost exactly what was in the tutorials. I don't what know else any of us can do for you after this point.Just out of curiosity, what exactly does someone have to do to teach you something? You been coddled and spoon fed, so I'm pretty interested to know what one can do if even that has failed. What more could you ask of us at this point? what are you expecting from us, because clearly nothing is working for you...
Link to comment
Share on other sites

Seriously scientist give it up, you are going to end up more stressed than this guy claims he is, its a total waste of time, its like working with someone like mister Bean, with a memory span of a goldfish, just sit back, read the posts and l have a stress free laugh at it all. its great!, almost 200 posts and his just managed to read posted data from a form, its hilarious, especially when continuously adding semi colon to end of php code (end curly brackets) for no apparent reason, after been told several times not, ha, ha.HA, he's messing with us, must be.
:)you know, in the back of mind I've always wondered if he was troll. If he is, he's gotten us all (me especially) good.
Link to comment
Share on other sites

Well, I'm pretty sure thats what it said on your website, and anyway you can't be that awake, more like in a coma, AS IN, what do think you have been attempting to learn for the last 6+ months.
I´m not going to use the website a long time! About the second point you´ll understand in a few weeks when I publish my story on the website of W3Schools (and you´ll ´judge´ different! Now they are ´prejudiges´; I hate them!)
Link to comment
Share on other sites

I´m not going to use the website a long time! About the second point you´ll understand in a few weeks when I publish my story on the website of W3Schools (and you´ll ´judge´ different! Now they are ´prejudiges´; I hate them!)
wow. you're just tapped. just get over yourself. If you think that's why were so frustrated with you, because of some sort of alleged prejudice, then you've clearly lost the plot and there's no hope for you.go ahead, write about us all on w3schools.com. this is the only rebuttal we'll need. http://w3schools.invisionzone.com/index.ph...mp;highlite=%2Bimagine if that was unleashed on the entire internet. eduardchile would go viral in no time. :)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...