Jump to content

Why it doesn´t work? Is this the solution?


eduard

Recommended Posts

  • Replies 60
  • Created
  • Last Reply
You have mismatched quotes:if(isset($_POST["price'])These are very simple errors. Even if you don't understand what the errors mean, you can usually find the error by looking at or around the line it points you to. Most (if not all) of the errors you've posted are simple syntax errors.EDIT:I think you might also be missing an 'else' here:mysql_close($con);{echo "one or more form fields missing";};should be:mysql_close($con);} else {echo "one or more form fields missing";};
Sorry, I got this post by you!
Link to comment
Share on other sites

You have mismatched quotes:if(isset($_POST["price'])These are very simple errors. Even if you don't understand what the errors mean, you can usually find the error by looking at or around the line it points you to. Most (if not all) of the errors you've posted are simple syntax errors.EDIT:I think you might also be missing an 'else' here:mysql_close($con);{echo "one or more form fields missing";};should be:mysql_close($con);} else {echo "one or more form fields missing";};
I don´t understand: }else Only a closing curly .....?
Link to comment
Share on other sites

Eduard, have you looked into the book I recommended? It's going to be the fastest and easiest way for you to learn this. I've asked you that question a couple times but you haven't answered it.
Books of php? Here in the south of Chile? This is SOUTH America!
Link to comment
Share on other sites

Books of php? Here in the south of Chile? This is SOUTH America!
if you have the internet, you can order books through.... the internet.http://www.amazon.com/Programming-PHP-Rasm...0141&sr=8-1http://www.amazon.com/gp/help/customer/dis...s?nodeId=596202
Link to comment
Share on other sites

Books of php? Here in the south of Chile? This is SOUTH America!
You know, for someone who goes on and on about how much you "hate prejudice", you definitely have a lot of bad things to say about people in Chile. First it was that Chileans don't know about databases, they don't know how to program, they're not nice, etc, and now apparently Chile doesn't have book stores or they can't read or something. If you're going to talk about how much you hate prejudice, you should probably avoid being prejudiced yourself.I'll also say this: until you're going to get serious about helping yourself, and step 1 of that is to buy that book and read it, I'm not going to help with your questions. I'm not going to spend my time and effort trying to help someone who is not helping themselves. I've told you to get that book at least twice, that it would be the quickest and easiest way for you to learn, and that you can probably find a copy in either Dutch or Spanish if you prefer, and not only have you ignored or not even read those messages, but you haven't even tried to find the book.Help yourself before you expect help from others.
Link to comment
Share on other sites

You know, for someone who goes on and on about how much you "hate prejudice", you definitely have a lot of bad things to say about people in Chile. First it was that Chileans don't know about databases, they don't know how to program, they're not nice, etc, and now apparently Chile doesn't have book stores or they can't read or something. If you're going to talk about how much you hate prejudice, you should probably avoid being prejudiced yourself.I'll also say this: until you're going to get serious about helping yourself, and step 1 of that is to buy that book and read it, I'm not going to help with your questions. I'm not going to spend my time and effort trying to help someone who is not helping themselves. I've told you to get that book at least twice, that it would be the quickest and easiest way for you to learn, and that you can probably find a copy in either Dutch or Spanish if you prefer, and not only have you ignored or not even read those messages, but you haven't even tried to find the book.Help yourself before you expect help from others.
You are totally right, BUT I haven´t got any money now to order books! Half a year I haven´t gas, I don´t have a fridge, etc. I just have money to SURVIVE!P. s. all the facts above are true, so they are NOT prejudices!
Link to comment
Share on other sites

You are totally right, BUT I haven´t got any money now to order books! Half a year I haven´t gas, I don´t have a fridge, etc. I just have money to SURVIVE!
lol internet connection
Link to comment
Share on other sites

I still get error messages of MAMP! Very confusing, because you say to do this and MAMP says don´t do it?<html><body><?phpvar_dump($_POST);if (isset($_POST['price']) && isset($_POST['description']) && isset($_POST['quantity'])){echo "succesful 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 products (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 or more form fields missing";}?></body></html>

Link to comment
Share on other sites

I still get error messages of MAMP! Very confusing, because you say to do this and MAMP says don´t do it?<html><body><?phpvar_dump($_POST);if (isset($_POST['price']) && isset($_POST['description']) && isset($_POST['quantity'])){echo "succesful 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 products (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 or more form fields missing";}?></body></html>
Bolded parts seem like they might be syntax problems.
Link to comment
Share on other sites

lol internet connection
If you´re in a wheelchair it´s a MUST (especially here!) Internet connection? I can write a very long list what I don´t have!
Link to comment
Share on other sites

try posting your code with indents and formatting. It makes it easier for other's to read and will help you see when you have extraneous characters in your script. Also, be mindful that you include error message, confirming the actual line (like this code here) is line 7. If we indent/format your code, let's see how it looks.it should be clear if you review the actual post that you are referring to.
<?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';};?>

edit: I mean, now we're just talking about copy/paste. Doesn't get much more basic/simpler than that...

copy/paste I don´t learn php!
Link to comment
Share on other sites

Your very first if statement is never closed. There is one } bracket missing
That´s what I wrote severaal times! It´s very hard to see the difference between () and {}! Is it open?
Link to comment
Share on other sites

You are totally right, BUT I haven´t got any money now to order books! Half a year I haven´t gas, I don´t have a fridge, etc. I just have money to SURVIVE!
Sorry, but I don't buy it. The book is, what, $30? If you're serious about learning this stuff, if you really want to help yourself, then you'll be able to find $30 somewhere to help you do that. In other words, if it's important to you, then you can find a way to make it happen. If you can't make it happen, then it must not be important to you. I've heard you give a lot of excuses about why you can't do whatever, but there are always a thousand excuses not to do something. I'm not interested in your excuses why you're not going to do something, I want to see a commitment that you're going to overcome your problems and help yourself out.
P. s. all the facts above are true, so they are NOT prejudices!
They're not true at all, they are in fact your prejudices. Look at this, a list of Linux user groups in Chile:http://www.gulix.cl/wiki/Otras_Comunidades_GNU/LinuxYou think the people in Linux user groups don't understand databases, and don't know how to program? I guarantee they do. I've also seen a listing for a PHP user group in Santiago, and here you go, here's the Chilean Oracle user group:http://www.cloug.org/1.htmlYou think the Oracle user group knows something about databases? I think they probably do.
Link to comment
Share on other sites

That´s what I wrote severaal times! It´s very hard to see the difference between () and {}! Is it open?
Yes. That's what I meant when I said it wasn't closed.
Link to comment
Share on other sites

Sorry, but I don't buy it. The book is, what, $30? If you're serious about learning this stuff, if you really want to help yourself, then you'll be able to find $30 somewhere to help you do that. In other words, if it's important to you, then you can find a way to make it happen. If you can't make it happen, then it must not be important to you. I've heard you give a lot of excuses about why you can't do whatever, but there are always a thousand excuses not to do something. I'm not interested in your excuses why you're not going to do something, I want to see a commitment that you're going to overcome your problems and help yourself out.They're not true at all, they are in fact your prejudices. Look at this, a list of Linux user groups in Chile:http://www.gulix.cl/wiki/Otras_Comunidades_GNU/LinuxYou think the people in Linux user groups don't understand databases, and don't know how to program? I guarantee they do. I've also seen a listing for a PHP user group in Santiago, and here you go, here's the Chilean Oracle user group:http://www.cloug.org/1.htmlYou think the Oracle user group knows something about databases? I think they probably do.
Exactly, but Santiago is the capital of Chile (with more than 6.000.000 inhabitants) 600 miles away from where I live!Linux or Oracle, that´s Santiago, maybe in Concepción (the second city!)No, in my región (Araucanía) are 6 Linux user groups, even 1 in my town (Villarrica)!
Link to comment
Share on other sites

I still have errors!<html><body><?phpvar_dump($_POST);if (isset($_POST['price']) && isset($_POST['description']}) && isset($_POST['quantity'])){echo "succesful 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 products (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 or more form fields missing";}?></body></html>Could you clearly write if it is a () or a {} please?

Link to comment
Share on other sites

Sorry, but I don't buy it. The book is, what, $30? If you're serious about learning this stuff, if you really want to help yourself, then you'll be able to find $30 somewhere to help you do that. In other words, if it's important to you, then you can find a way to make it happen. If you can't make it happen, then it must not be important to you. I've heard you give a lot of excuses about why you can't do whatever, but there are always a thousand excuses not to do something. I'm not interested in your excuses why you're not going to do something, I want to see a commitment that you're going to overcome your problems and help yourself out.They're not true at all, they are in fact your prejudices. Look at this, a list of Linux user groups in Chile:http://www.gulix.cl/wiki/Otras_Comunidades_GNU/LinuxYou think the people in Linux user groups don't understand databases, and don't know how to program? I guarantee they do. I've also seen a listing for a PHP user group in Santiago, and here you go, here's the Chilean Oracle user group:http://www.cloug.org/1.htmlYou think the Oracle user group knows something about databases? I think they probably do.
WHAT DO YOU THINK I´VE BEEN DOING THE PAST 27 MONTHS (AND IT WAS VERY HARD!)P. s. I hate prejudices; I hate excuses too!!!
Link to comment
Share on other sites

WHAT DO YOU THINK I´VE BEEN DOING THE PAST 27 MONTHS (AND IT WAS VERY HARD!)
How would I know what you've been doing? All I know is what I see here, and what I see here is people repeatedly explaining the same things (like $_POST), and you repeatedly asking questions because you still don't understand. That seems to me like you're not making an effort to learn it. If you were making an effort to learn it, you would get a book and take the responsibility to learn it for yourself instead of expecting us to answer the same questions over and over. If we explain what $_POST is to you 10 times, and you still don't understand, what difference is it going to make if we try again? Obviously you're not able to learn what we're trying to teach you, so why does it make sense for us to keep trying?I believe that you think you're making an effort, but I don't think that what you are doing is effective. You should know it's not effective, and look for a better way. I'm trying to tell you that a book like Programming PHP is a better way.
in my región (Araucanía) are 6 Linux user groups, even 1 in my town (Villarrica)!
Right, so there are plenty of people near you who know this stuff, but you still say that Chileans don't understand this, which is why that is a prejudicial statement. You are prejudiced against Chileans.
I hate excuses too
So stop making excuses, get the book, and help yourself!
Link to comment
Share on other sites

in other words, what you've been doing hasn't been working. It's time for a good re-evaluation and taking the initiative for a new game plan for learning how to program. A book is an essential first step if you're having this much trouble at this point of the game. And it sounds like there are plenty of technology savy people in your country. Try finding a local forum or meetup location that maybe you could attend. Anything that's different than asking what (), or . means.... :)

Link to comment
Share on other sites

Archived

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


×
×
  • Create New...