Jump to content

Show insert data in database on my website?


eduard

Recommended Posts

Why did you change this:

$result = mysql_query ("SELECT ID, Description, Price, QuantityFROM ProductsORDER BY ID, Price DESCLIMIT 1") or exit(mysql_error()
to this:
$result = mysql_query ("SELECT ID, Description, Price, QuantityFROM ProductsORDER BY ID, Price DESCLIMIT 1")
thescientist said this:
looks like you forgot a closing paren --> )
He said you left out a paren, and you remove the error checking? Look at this:exit(mysql_error()There are 2 opening parens, and 1 closing paren. That means you're missing a closing one, they need to match up. You should also know by now that all of your statements need to end with a semicolon, so it should be like this:exit(mysql_error());You also removed this part though:
if (!$result) {echo mysql_error();}
You only need one or the other, so this would make sense:
$result = mysql_query ("SELECT ID, Description, Price, QuantityFROM ProductsORDER BY ID, Price DESCLIMIT 1");if (!$result) { echo mysql_error();}
I don't think people are telling you a bunch of different things, I think you are not understanding what people are telling you to do. Again, it's not our fault that you're having problems learning this. We shouldn't need to tell you about semicolons and parentheses, you should understand those by now. These are basic errors, this is not advanced. You haven't gotten to the advanced parts yet. I know you're going to say something like "It's easy for you, but not for me", except you'll do it with capital letters and exclamation points, but if the basics are not easy for you then it means you haven't learned them yet. You need to learn the basics. That's why we keep suggesting reading the tutorials, reading the PHP manual, get a book, etc, something, anything to teach you the basics. Until you do that, you're going to keep having the same problems you're having now.
Link to comment
Share on other sites

  • Replies 190
  • Created
  • Last Reply
Why did you change this:to this:thescientist said this:He said you left out a paren, and you remove the error checking? Look at this:exit(mysql_error()There are 2 opening parens, and 1 closing paren. That means you're missing a closing one, they need to match up. You should also know by now that all of your statements need to end with a semicolon, so it should be like this:exit(mysql_error());You also removed this part though:You only need one or the other, so this would make sense:I don't think people are telling you a bunch of different things, I think you are not understanding what people are telling you to do. Again, it's not our fault that you're having problems learning this. We shouldn't need to tell you about semicolons and parentheses, you should understand those by now. These are basic errors, this is not advanced. You haven't gotten to the advanced parts yet. I know you're going to say something like "It's easy for you, but not for me", except you'll do it with capital letters and exclamation points, but if the basics are not easy for you then it means you haven't learned them yet. You need to learn the basics. That's why we keep suggesting reading the tutorials, reading the PHP manual, get a book, etc, something, anything to teach you the basics. Until you do that, you're going to keep having the same problems you're having now.
Probably you are right! But I also have written that I´m not in a normal situation! Your description seems to me a normal situation!
Link to comment
Share on other sites

Probably you are right! But I also have written that I´m not in a normal situation! Your description seems to me a normal situation!
So do you expect we can just bend the PHP syntax to suit you? Honestly i dont understand what you are trying to accomplish. If you want to get into web development and sell yourself as a programmer you have to be able to sort out simple syntax errors.Edit: if your having a hard time on syntax. it might be an idea to download notepad++ it highlights curtain pieces of code so it's easier to see where a syntax error might exist
Link to comment
Share on other sites

Why did you change this:to this:thescientist said this:He said you left out a paren, and you remove the error checking? Look at this:exit(mysql_error()There are 2 opening parens, and 1 closing paren. That means you're missing a closing one, they need to match up. You should also know by now that all of your statements need to end with a semicolon, so it should be like this:exit(mysql_error());You also removed this part though:You only need one or the other, so this would make sense:I don't think people are telling you a bunch of different things, I think you are not understanding what people are telling you to do. Again, it's not our fault that you're having problems learning this. We shouldn't need to tell you about semicolons and parentheses, you should understand those by now. These are basic errors, this is not advanced. You haven't gotten to the advanced parts yet. I know you're going to say something like "It's easy for you, but not for me", except you'll do it with capital letters and exclamation points, but if the basics are not easy for you then it means you haven't learned them yet. You need to learn the basics. That's why we keep suggesting reading the tutorials, reading the PHP manual, get a book, etc, something, anything to teach you the basics. Until you do that, you're going to keep having the same problems you're having now.
I have thought (yes, I can think!) about it! I read yesterday your replies another time and I tried 2 things at the same time: your reply of ´exit¨(I forgot indeed a bracket!) and a reply of dsoneuk (about ID!) So, what I intend now to try 1 reply!
Link to comment
Share on other sites

So do you expect we can just bend the PHP syntax to suit you? Honestly i dont understand what you are trying to accomplish. If you want to get into web development and sell yourself as a programmer you have to be able to sort out simple syntax errors.Edit: if your having a hard time on syntax. it might be an idea to download notepad++ it highlights curtain pieces of code so it's easier to see where a syntax error might exist
Wrong! An error is not that dificult! If you are relaxed (so you have enough time!) you can search for it, but as I wrote several times I am NOT relaxed (stressed!) and that´s much more complicated!
Link to comment
Share on other sites

Unknown column 'ID' in 'field list'Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/eduardli/public_html/web_designer/insert.php on line 30Description Price Quantity <html><body><?php$con = mysql_connect("localhost","eduardli_user","-z.x,c");if (!$con){die('Could not connect: ' . mysql_error());}mysql_select_db("eduardli_company", $con);$result = mysql_query ("SELECT ID, Description, Price, QuantityFROM ProductsORDER BY ID, Price DESCLIMIT 1");if(!$result) {echo mysql_error(); }echo"<table border='1'><tr><th>Description</th><th>Price</th><th>Quantity<th></tr>";while($row = mysql_fetch_assoc($result)){echo "<td>" . $row['Description'] . "</br>";echo "<td>" . $row['Price'] . "</td>";echo "<td>" . $row['Quantity'] . "</td>";}echo "</table>";mysql_close($con);?></body></html> The error and the file?

Link to comment
Share on other sites

that means you dont have the column 'ID' in your database. You have to make sure and correctly mention the column names. For that reason mysql_query() is failing.

Link to comment
Share on other sites

Wrong! An error is not that dificult! If you are relaxed (so you have enough time!) you can search for it, but as I wrote several times I am NOT relaxed (stressed!) and that´s much more complicated!
Hey man ....relax it will all work itself out...I mean I was doing the same as you..and I figured it out with the help here..just take your time..and read your script over slowly..to make sure all the dot's and " T's " are crossed..If I can do it ... then you can..I mean I am 61 years old..never too old to learn...
Link to comment
Share on other sites

that means you dont have the column 'ID' in your database. You have to make sure and correctly mention the column names. For that reason mysql_query() is failing.
That´s obvious! What´s NOT obvious to me is that the person who replied this to me didn´t write that I should have a column ´ID´!
Link to comment
Share on other sites

That´s obvious! What´s NOT obvious to me is that the person who replied this to me didn´t write that I should have a column ´ID´!
Hey on W2Schools example's show you that??
$sql = "CREATE TABLE Persons  ( personID int NOT NULL AUTO_INCREMENT, <<<<< here the Id is set...PRIMARY KEY(personID),   FirstName varchar(15), LastName varchar(15), Age int )"; mysql_query($sql,$con);

Link to comment
Share on other sites

Wrong! An error is not that dificult! If you are relaxed (so you have enough time!) you can search for it, but as I wrote several times I am NOT relaxed (stressed!) and that´s much more complicated!
get... over.... yourself. stop coming here if you aren't willing to learn the right way. If your situation isn't conducive to learning correctly, then STOP. Don't you see how ineffectual your approach has been? You aren't really learning anything, you can't even copy paste code! Stop blaming everyone but yourself. If you aren't ready to do this the right way, don't expect us to cut you any slack. We are not here to prop you up and solve all of your problems. The fact that you can't solve basic syntax problems illustrates how unready you are for greater developing/programming concepts. Stop throwing your frustration around here like you're special for whatever reasons you think you are.
That´s obvious! What´s NOT obvious to me is that the person who replied this to me didn´t write that I should have a column ´ID´!
Yes. he did.
No, the easy way is just insert an extra int field (usually 'ID') that uses auto increment, so every time a new record is submitted, this field increases by one, for that specific record. You don't have to include this in the insert form, just in the select page using$result = mysql_query ("SELECT ID, Description, Price, QuantityFROM ProductsORDER BY ID, Price DESCLIMIT 1");to sort by the highest ID value (the latest record), then by Price.
he said you HAVE TO CREATE AN INT FIELD. Again, you don't read and you don't learn. We can't consume the knowledge for you. Learn and read properly or do something else if you don't have the patience for this. Your only getting yourself worked up and taking it out on us. :)
Link to comment
Share on other sites

who replied this to me didn´t write that I should have a column ´ID´!
what columns should be in and what should be not its depends on what you are trying accomplish.If you dont need a ID and its not in your database then why should you mention this in your query? ID is identical its not obvious that you should have the same column name 'ID'
Link to comment
Share on other sites

get... over.... yourself. stop coming here if you aren't willing to learn the right way. If your situation isn't conducive to learning correctly, then STOP. Don't you see how ineffectual your approach has been? You aren't really learning anything, you can't even copy paste code! Stop blaming everyone but yourself. If you aren't ready to do this the right way, don't expect us to cut you any slack. We are not here to prop you up and solve all of your problems. The fact that you can't solve basic syntax problems illustrates how unready you are for greater developing/programming concepts. Stop throwing your frustration around here like you're special for whatever reasons you think you are.Yes. he did.he said you HAVE TO CREATE AN INT FIELD. Again, you don't read and you don't learn. We can't consume the knowledge for you. Learn and read properly or do something else if you don't have the patience for this. Your only getting yourself worked up and taking it out on us. :)
What I should do: DON´T FORGET TO ADD A EXTRA FIELD TO YOUR DATABASE! (that you can´t miss!)
Link to comment
Share on other sites

What I should do: DON´T FORGET TO ADD A EXTRA FIELD TO YOUR DATABASE! (that you can´t miss!)
Wow..112 posts for a simply problem...I solved mine in 23...and I'm an old man of 61 and dumb...to all this..
Link to comment
Share on other sites

Why did you change this:to this:thescientist said this:He said you left out a paren, and you remove the error checking? Look at this:exit(mysql_error()There are 2 opening parens, and 1 closing paren. That means you're missing a closing one, they need to match up. You should also know by now that all of your statements need to end with a semicolon, so it should be like this:exit(mysql_error());You also removed this part though:You only need one or the other, so this would make sense:I don't think people are telling you a bunch of different things, I think you are not understanding what people are telling you to do. Again, it's not our fault that you're having problems learning this. We shouldn't need to tell you about semicolons and parentheses, you should understand those by now. These are basic errors, this is not advanced. You haven't gotten to the advanced parts yet. I know you're going to say something like "It's easy for you, but not for me", except you'll do it with capital letters and exclamation points, but if the basics are not easy for you then it means you haven't learned them yet. You need to learn the basics. That's why we keep suggesting reading the tutorials, reading the PHP manual, get a book, etc, something, anything to teach you the basics. Until you do that, you're going to keep having the same problems you're having now.
What I don´t understand when you wrote ´exit´ (mysql_error ....) that I MUST DELETE THE OTHER´mysql_error´in the file! It would have saved me a lot of time and stress!
Link to comment
Share on other sites

What I should do: DON´T FORGET TO ADD A EXTRA FIELD TO YOUR DATABASE! (that you can´t miss!)
i dont understand what you are trying to say. what dsonesuk said was to add an auto incrementing INT field called ID. we've had lengthy discussions on fields, columns, and records before (with beon_robot) I believe. If you don't understand what someone says you need to say so. If you don't have the time to read someone's entire post don't just blindly try it without knowing what you are doing.
Link to comment
Share on other sites

What I should do: DON´T FORGET TO ADD A EXTRA FIELD TO YOUR DATABASE! (that you can´t miss!)
that would be wrong! cause you add it to the table in DATABASE, NOT to databaseField if you bother to look it up is a column in table, but as we know you can't be bothered to, and your so stressed YAWN! , and where/how else are you supposed to specify that it should be a INT, and use AUTO INCREMENT, you have been through all this in creating a table and columns/fields, silly me i thought 'My god! he's finally getting it!" WRONG!
Link to comment
Share on other sites

that would be wrong! cause you add it to the table in DATABASE, NOT to databaseField if you bother to look it up is a column in table, but as we know you can't be bothered to, and your so stressed YAWN! , and where/how else are you supposed to specify that it should be a INT, and use AUTO INCREMENT, you have been through all this in creating a table and columns/fields, silly me i thought 'My god! he's finally getting it!" WRONG!
You are right: must be a table (of a database), NOT a database!
Link to comment
Share on other sites

I still don´t have it: Description Price Quantity 0mutt200 5- I want the most recent values!- 0 I don´t understand!

Link to comment
Share on other sites

Eduard, I think I've just about had enough of this. You never take credit for any of your problems, it's always either someone else's fault or some aspect of your life that makes you unique and different from everyone else some how, as if everyone else doesn't deal with stress in their lives. You're not the only disabled person, you're not the only person with financial problems, you're not the only person dealing with stress, etc. You refuse to step up and learn this stuff, for the past 20 posts or so nearly all you've done is blame your problems on everything except yourself, it's almost like you're not even trying to program at this point:

Probably you are right! But I also have written that I´m not in a normal situation! Your description seems to me a normal situation!
I have thought (yes, I can think!) about it! I read yesterday your replies another time and I tried 2 things at the same time: your reply of ´exit¨(I forgot indeed a bracket!) and a reply of dsoneuk (about ID!) So, what I intend now to try 1 reply!
Wrong! An error is not that dificult! If you are relaxed (so you have enough time!) you can search for it, but as I wrote several times I am NOT relaxed (stressed!) and that´s much more complicated!
That´s obvious! What´s NOT obvious to me is that the person who replied this to me didn´t write that I should have a column ´ID´!
What I should do: DON´T FORGET TO ADD A EXTRA FIELD TO YOUR DATABASE! (that you can´t miss!)
Then you say stuff like this:
What I don´t understand when you wrote ´exit´ (mysql_error ....) that I MUST DELETE THE OTHER´mysql_error´in the file! It would have saved me a lot of time and stress!
I've tried everything I can think of to save you time and stress, Eduard. I've given you advice about what I think you should do in order to be most effective at learning this and making money as soon as possible, but you haven't taken my advice. The problem isn't me Eduard, it's you.I have to agree with others, I don't think programming is in your future. I think you should look for something else that's easier for you to do, because this is obviously too difficult for you to understand anything to the point that you'll be able to make money with it. You're either not willing or not able to put in the level of effort that is required to learn a skill like this, and there's nothing anyone else can do to change that except yourself. At the end of the day it doesn't matter why you have problems learning, whether it's from stress or money or living in a house that doesn't suit you or whatever else you want to blame it on. Whatever the reason is, the result is that you can't learn this stuff right now. You should find another way to make money and in the future when you're able to learn this you can decide if you want to try again.
Link to comment
Share on other sites

Wow..112 posts for a simply problem...I solved mine in 23...and I'm an old man of 61 and dumb...to all this..
Are you old???? My grandmother is old! She´s 102P. s. I am a simple person (thank God!)
Link to comment
Share on other sites

I still don´t have it: Description Price Quantity 0mutt200 5- I want the most recent values!- 0 I don´t understand!
because the ID value will be unique, it will make sorting by price redundant, not like sorting by persons first name and last name, where you have multiple duplicate values in both, so you will have to remove the 'Price' from the ORDER BY statement.$result = mysql_query ("SELECT ID, Description, Price, QuantityFROM ProductsORDER BY ID DESCLIMIT 1");
Link to comment
Share on other sites

Eduard, I think I've just about had enough of this. You never take credit for any of your problems, it's always either someone else's fault or some aspect of your life that makes you unique and different from everyone else some how, as if everyone else doesn't deal with stress in their lives. You're not the only disabled person, you're not the only person with financial problems, you're not the only person dealing with stress, etc. You refuse to step up and learn this stuff, for the past 20 posts or so nearly all you've done is blame your problems on everything except yourself, it's almost like you're not even trying to program at this point:Then you say stuff like this:I've tried everything I can think of to save you time and stress, Eduard. I've given you advice about what I think you should do in order to be most effective at learning this and making money as soon as possible, but you haven't taken my advice. The problem isn't me Eduard, it's you.I have to agree with others, I don't think programming is in your future. I think you should look for something else that's easier for you to do, because this is obviously too difficult for you to understand anything to the point that you'll be able to make money with it. You're either not willing or not able to put in the level of effort that is required to learn a skill like this, and there's nothing anyone else can do to change that except yourself. At the end of the day it doesn't matter why you have problems learning, whether it's from stress or money or living in a house that doesn't suit you or whatever else you want to blame it on. Whatever the reason is, the result is that you can't learn this stuff right now. You should find another way to make money and in the future when you're able to learn this you can decide if you want to try again.
Ok, if you want it that way:- I am the only disabled Dutch man living in Chile- I am the only person who receives 2 year and a half (very!) bad e-mails of his family who say for 2 years and a half stop supporting me- I am the only disabled person who lives alone in a non-adapted house in Chile- I assume I am the only person of this forum to whom lives the daughter of the chilean owner lives next door- etc.Conclusion: I totally disagree with you! I have to find a suitable place for me, where I can work quiet! However, to achieve that money is necesary! Because there´s a lot of discrimination here (also to disabled persons!) I decided at the beginning of this year to do this! I´ll finish this job and after that ......? (I take a beer!))
Link to comment
Share on other sites

Are you old???? My grandmother is old! She´s 102P. s. I am a simple person (thank God!)
Hey, sorry was not trying to be insulting here...if it came across that way sorry again..I was just trying to point out that the boys here know what they are doing..they got me set up my database to: insert, and display results from scratch..scripting..and following the example's ...I think the problem here is a language barrier...Sorry bud..just take your time and try not to read to much into what is being said by these guys..look at what is being said and see if you can find an example to help you understand what they are telling you...I do hope you get it working...but it would also help if you explained exactly what you want your database to do..Cheers..
Link to comment
Share on other sites

Hey, sorry was not trying to be insulting here...if it came across that way sorry again..I was just trying to point out that the boys here know what they are doing..they got me set up my database to: insert, and display results from scratch..scripting..and following the example's ...I think the problem here is a language barrier...Sorry bud..just take your time and try not to read to much into what is being said by these guys..look at what is being said and see if you can find an example to help you understand what they are telling you...I do hope you get it working...but it would also help if you explained exactly what you want your database to do..Cheers..
They know what my database is supposed to do! (see previous posts!)
Link to comment
Share on other sites

Archived

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


×
×
  • Create New...