• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why nothing is showing from my DB table?

 
Mohammad Ashari Rahman
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


html



Both sqlite.php and sqlite.html in htdocs folder but output is



what am I doing wrong
 
Mohammad Ashari Rahman
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved it )



 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohammad Ashari Rahman wrote:Solved it )

What did you change? Might be helpful for other ranchers as well.
 
Ralph van Delft
Greenhorn
Posts: 9
Java Linux PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The change he made (as far as I can see):


From:



to:



 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ralph van Delft wrote:The change he made (as far as I can see):

But I wonder if that change did the trick. I'm inclined to say it didn't, because that would mean there's a difference in PHP between $row['name'] and $row["name"]. Also he uses $row["name"] to print out the price of the item (which is incorrect based on the column's name).
 
Ralph van Delft
Greenhorn
Posts: 9
Java Linux PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, that make sense.

second attempt:



He changed his form form:


to:


Look at the 'name' property in the ID input: 'id_' to 'name.

That makes sense, right?
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ralph van Delft wrote:That makes sense, right?

Makes indeed more sense, but still not convinced If you have a look at the first post, you'll see that retrieving the values for id and name are commented out. Also the query used in the php code snippet has no WHERE clause and thus still all rows should have been returned when submitting the form (because submitted form values are simply ignored).
 
Abderrahmen Ben Mariem
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should make sure that the table is not empty.
Try to execute the select query directly on the database to make sure that it returns something.
 
Cor van Holk
Greenhorn
Posts: 2
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at this: http://www.w3schools.com/html/html_form_input_types.asp
Now do you see what is wrong with your form? Also I do not see a connection string to your database like $con = ...

But I only know how to connect to MySQl or MsSQL.
 
Tim Cooke
Sheriff
Pie
Posts: 3210
142
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Cor van Holk, welcome to the Ranch!

Perhaps not related to the particular article you have linked to, but in general the w3schools tutorial site is not great quality. I have heard many reports of problems with the information given there. Viewer discretion is advised.
 
Cor van Holk
Greenhorn
Posts: 2
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Cooke wrote:

Perhaps not related to the particular article you have linked to, but in general the w3schools tutorial site is not great quality. I have heard many reports of problems with the information given there. Viewer discretion is advised.


Thanks for the welcome, but the flak I receive for pointing to a link that clearly and correctly shows what is wrong with the form the OP made, drives me away from this forum. It is called a friendly place!?

I will not spend my precious time and knowledge on a forum that responds in the way you did Tim.

So goodbye to the Javaranch.
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Cooke wrote:Perhaps not related to the particular article you have linked to, but in general the w3schools tutorial site is not great quality. I have heard many reports of problems with the information given there. Viewer discretion is advised.

Seriously? I did not know that. And that does not match my experiences I had on the numerous occasions when I used the w3schools tutorial site.
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Tim Cooke wrote:Perhaps not related to the particular article you have linked to, but in general the w3schools tutorial site is not great quality. I have heard many reports of problems with the information given there. Viewer discretion is advised.

Seriously? I did not know that. And that does not match my experiences I had on the numerous occasions when I used the w3schools tutorial site.


W3Fools existed for a reason.
W3Schools has fixed most (possibly all by now) of the issues raised, hence Fools has hung up its boots (so to speak).
It did have lots of quality issues back in the day, and it still suffers from the bad word of mouth, which is probably not entirely justified anymore. I'm not without sin in that regard, it has to be said!
 
Tim Cooke
Sheriff
Pie
Posts: 3210
142
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wasn't aware of that Dave, thanks.

OK, I take back all suggestion that w3schools is anything less than a fine programming resource.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic