Jump to content

Show insert data in database on my website?


eduard

Recommended Posts

we've mentioned it before, but yes you can. The point of programming is have to the computer do whatever you want.

Link to comment
Share on other sites

  • Replies 190
  • Created
  • Last Reply
we've mentioned it before, but yes you can. The point of programming is have to the computer do whatever you want.
If so, where do I find a good example?
Link to comment
Share on other sites

Eduard! I went to your site and added some data to your database. Then I saw it show up in your table. I think you are beginning to get it. Good job. :)
However, the ´problem´ now is much more complicated: showing the most recent inserted data in a diagram on my website!
Link to comment
Share on other sites

You posted an insert script, from your site, and a select script, from an example. If you want to change that select script to work with your database, change the query so that it selects the correct field names from the correct table, and change the while loop where it prints each row to use the correct field names. You'll also need to update the connection and mysql_select_db information so it uses your database information.
Is this the solution?
Link to comment
Share on other sites

I send my SELECT script:<html><body><?php$con = mysql_connect("localhost","eduardli_user","");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("eduardli_company", $con);$result = mysql_query("SELECT * FROM Products");echo "<table border='1'><tr><th>Description</th><th>Price</th><th>Quantity<th></tr>";while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Description'] . "</td>"; echo "<td>" . $row['Price'] . "</td>"; echo "<td>" . $row['Quantity'] . "</td>"; echo "</tr>"; }echo "</table>";mysql_close($con);?></body></html>What do I have to change and how do I update my mysql connection? (tutorial UPDATE database!)But I need to have 2 SELECT files?1 to SELECT data2 to show INSERTed data???
So the answer is already given to me 6 days ago?
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. :)
If programming only is copy and paste code: everyone could do it!
Link to comment
Share on other sites

I exactly know what I need! (I write it here!)But another time I don´t know it in programming language!Maybe someone can ´translate´ it for me?I want to show the inserted most recent data in a diagram on my website (www.eduardlid.com)!So first I have to INSERT data into the table of my database!Then I have to FETCH the data by a SELECT php script in a html file so that it shows on my website!After a week of trying I´m still not able to do this!

Link to comment
Share on other sites

So simply putSomeone enters " Data "Then you want this " Data " viewed by others when called for..if this is so you should follow my posts..." Adding Data "..it does what you are asking for...and this is because the gents here were very helpful..got this working in no time..

Link to comment
Share on other sites

So simply putSomeone enters " Data "Then you want this " Data " viewed by others when called for..if this is so you should follow my posts..." Adding Data "..it does what you are asking for...and this is because the gents here were very helpful..got this working in no time..
And now in programming languge (the file please?)
Link to comment
Share on other sites

The answer is here, but I don´t know how to write it in programming language!that should be the last record of details that has been submitted, which is what you wanted,

Link to comment
Share on other sites

And now in programming languge (the file please?)
LOL I have made two files..1: Form2: InsertNow go read carefullySorry its 3 files I made..3:Display
Link to comment
Share on other sites

For gods sake!look in phpmyadmin, look at record list (click your database->table products then select browse tab) what should be displayed is the records with a column ID with numbers 1 to the total records listed, the last INSERTED record(which is what you asked for NOT UPDATED record) should have the highest ID number, WHAT IS THAT RECORD? IS IT THE SAME AS THE ONE DISPLAYED? IF IT IS IT IS WORKING!

Link to comment
Share on other sites

For gods sake!look in phpmyadmin, look at record list (click your database->table products then select browse tab) what should be displayed is the records with a column ID with numbers 1 to the total records listed, the last INSERTED record(which is what you asked for NOT UPDATED record) should have the highest ID number, WHAT IS THAT RECORD? IS IT THE SAME AS THE ONE DISPLAYED? IF IT IS IT IS WORKING!
Thanks! Yesterday I came to the same conclusion!
Link to comment
Share on other sites

I don´t understand the error: 1 <html> 2 <body> 3 4 <?php 5 $con = mysql_connect("localhost","eduardli_user","-z.x,c"); 6 if (!$con) 7 { 8 die('Could not connect: ' . mysql_error()); 9 }10 $Description = $_POST["description"];11 $Price = $_POST["Price"];12 $Quantity = $_POST["Quantity"];13 14 mysql_select_db("eduardli_company", $con);15 16 17 mysql_query ("INSERT INTO Products (Description, Price, Quantity) 18 VALUES ('Description', 'Price', 'Quantity')");19 20 $result = mysql_query("SELECT * FROM Products"); 21 22 echo "<table border='1'>23 <th>Description</th>24 <th>Price</th>25 <th>Quantity<th>26 </tr>";27 28 while($row = mysql_fetch_assoc($result))29 {30 echo "<tr><td>" . $row["Description"] . "</td>";31 echo "<td>" . $row['Price'] . "</td>";32 echo "<td>" . $row['Quantity'] . "</td></tr>";33 echo "</tr>";34 }35 echo "</table>";36 37 mysql_close($con);38 ?>39 40 </body>41 </html>Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/eduardli/public_html/web_designer/insert.php on line 28Description Price Quantity

Link to comment
Share on other sites

I don´t understand the error: 1 <html> 2 <body> 3 4 <?php 5 $con = mysql_connect("localhost","eduardli_user","-z.x,c"); 6 if (!$con) 7 { 8 die('Could not connect: ' . mysql_error()); 9 }10 $Description = $_POST["description"];11 $Price = $_POST["Price"];12 $Quantity = $_POST["Quantity"];13 14 mysql_select_db("eduardli_company", $con);15 16 17 mysql_query ("INSERT INTO Products (Description, Price, Quantity) 18 VALUES ('Description', 'Price', 'Quantity')");19 20 $result = mysql_query("SELECT * FROM Products"); 21 22 echo "<table border='1'>23 <th>Description</th>24 <th>Price</th>25 <th>Quantity<th>26 </tr>";27 28 while($row = mysql_fetch_assoc($result))29 {30 echo "<tr><td>" . $row["Description"] . "</td>";31 echo "<td>" . $row['Price'] . "</td>";32 echo "<td>" . $row['Quantity'] . "</td></tr>";33 echo "</tr>";34 }35 echo "</table>";36 37 mysql_close($con);38 ?>39 40 </body>41 </html>Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/eduardli/public_html/web_designer/insert.php on line 28Description Price Quantity

Link to comment
Share on other sites

we've already gone over this. try reading your own threads. This was not more than 2/3 pages ago.... :)

Link to comment
Share on other sites

Of course not, that's why we've explained it to you several times. Is it so difficult to read what we write?
The problem is that you think this (simple) problem is the only problem I have to solve! VERY WRONG!
Link to comment
Share on other sites

The problem is that you think this (simple) problem is the only problem I have to solve! VERY WRONG!
Nobody who has replied to you has ever said that. We've answered every question you've asked. Several times, I might add. The problem is that you either don't read the answers you get or you don't remember them.
Link to comment
Share on other sites

The problem is that you think this (simple) problem is the only problem I have to solve! VERY WRONG!
:)If you have problems, what do you want us to do about it? What more can do but give you answers to programming questions? And once we've answered them all multiple times, at what point should we keep repeating them over, and over, and over again? I gave a very detailed explanation about this exact problem you are facing (with ShadowMage supplementing that answer too). Everyone here gives you more help than you apparently care to recognize, but nothing is ever good enough for you. Then you say you don't understand, but not which part, or with what aspect of it, throw up some hacked apart code that doesn't really any real attempt at having tried to solve the problem, and then you get more frustrated and come back here to vent at us, and round and round we go. They say you can lead a horse to water, but you can't make him drink. I still fail to see how we are responsible for all aspects of your life. Those are you own personal problems. What are we supposed to do about them? When you come here and ask questions, we answer them. We can't do anything more for you, so what is it you expect us to do for you? Solve all of your problems? If you're just frustrated because this is harder than you thought, then welcome to world of programming. Nothing worth doing is easy. Seriously... figure it out and move on.
Link to comment
Share on other sites

Nobody who has replied to you has ever said that. We've answered every question you've asked. Several times, I might add. The problem is that you either don't read the answers you get or you don't remember them.
I´ve written SEVERAL times that I´m stressed (because I´ve to solve many problems to solve!) I receive many replies! Is it strange that I miss important things? Nobody can concentrate well when he/she is stressed!But maybe you are never stressed?
Link to comment
Share on other sites

The problem is that you think this (simple) problem is the only problem I have to solve!
No, that's not what I think. The problem is that you don't pay attention to the answers we write. The problem is not how I'm thinking, the problem is how you are learning. Or, not learning. There's no reason to post the same answer to the same question again. If you didn't understand the answer the first time it was given, or the second or third time, there's no reason for me to think that if I post the answer again then all of a sudden you'll understand it. If you want the answer, it's in this very thread, go back and find it and pay attention. You asked the exact same questions in posts 65, 91, 106, and 165.
Is it strange that I miss important things?
Yes, it is strange when you miss important things over and over and over again. I would think that eventually you would figure out it's important and pay attention to it. So yeah, it's strange when you constantly fail to do that.
Link to comment
Share on other sites

Archived

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


×
×
  • Create New...