Jump to content

Showing database output on my website?


eduard

Recommended Posts

So, to show database tables on my website I have to make a list (php script saved as html document in my website folder and create a database (php) also saved in website folder?

Link to comment
Share on other sites

  • Replies 72
  • Created
  • Last Reply

oh...my...god. now I'm gonna start swearing.... what did we just TELL you...http://w3schools.invisionzone.com/index.php?showtopic=36852---PHP IS NOT (SAVED AS) HTML. IT'S PHP. THAT'S WHAT PHP MEANS. (Pre Hypertext Processor). EMPHASIS ON PRE!!!!!!!! (FYI: HTML mean Hypertext Markup Langauge. You might want to learn that to help yourself understand the connection).PHP IS NOT A DATABASE. A DATABASE IS A DATABASE. (you NEED/HAVE to learn the difference.)---PHP IS SAVED AS PHP. ITS IS A SERVER SIDE SCRIPTING LANGAUGE. (similar to Javascript)PHP CAN BE USED TO OUTPUT HTML/CSS.PHP CAN INTERACT WITH A DATABASE VIA SQL, WHICH IS USED TO GET INFO FROM A DATABASE FOR USE IN A PHP SCRIPT.PHP CAN USE THAT INFO FROM THAT DATABASE AND OUTPUT IT AS HTML.--We have told you what to do and how to do it hundreds of times. Put stuff in a database, use PHP to get it and then use PHP to write HTML/CSS. Bottom line, that's as clear as we can make it. Sorry if that's too complex for you to understand at this time, perhaps you should stick to focusing on HTML/CSS until you understand them better first.

Link to comment
Share on other sites

oh...my...god. now I'm gonna start swearing.... what did we just TELL you...http://w3schools.invisionzone.com/index.php?showtopic=36852---PHP IS NOT (SAVED AS) HTML. IT'S PHP. THAT'S WHAT PHP MEANS. (Pre Hypertext Processor). EMPHASIS ON PRE!!!!!!!! (FYI: HTML mean Hypertext Markup Langauge. You might want to learn that to help yourself understand the connection).PHP IS NOT A DATABASE. A DATABASE IS A DATABASE. (you NEED/HAVE to learn the difference.)---PHP IS SAVED AS PHP. ITS IS A SERVER SIDE SCRIPTING LANGAUGE. (similar to Javascript)PHP CAN BE USED TO OUTPUT HTML/CSS.PHP CAN INTERACT WITH A DATABASE VIA SQL, WHICH IS USED TO GET INFO FROM A DATABASE FOR USE IN A PHP SCRIPT.PHP CAN USE THAT INFO FROM THAT DATABASE AND OUTPUT IT AS HTML.--We have told you what to do and how to do it hundreds of times. Put stuff in a database, use PHP to get it and then use PHP to write HTML/CSS. Bottom line, that's as clear as we can make it. Sorry if that's too complex for you to understand at this time, perhaps you should stick to focusing on HTML/CSS until you understand them better first.
Yes, I know that for some time, but ShadowImage replied to me yesterday about my list (post 6)! So stop swearing how a database works (and I´m sorry I read the tutorials again! It is not clear how a database works-I believe phpMyadmin isn´t mentioned!) I know for a while! But again I´m a beginner and perhaps I don´t ask questions in the right way, forgive me!
Link to comment
Share on other sites

:) that's what I'm saying...
More appropriately:It is a PHP script with an HTML document in it. PHP sends the HTML to the browser.But yes, you would write a PHP script that does all the communicating between the user (and browser) and the database.
it's still a PHP page outputting HTML, with all the PHP stuff happening first. which is not how you seem to understand it.
So, to show database tables on my website I have to make a list (php script saved as html document in my website folder and create a database (php) also saved in website folder?
you need to understand the distinctions amongst all of them.you make records (items in a "list") for a database table using an HTML page with a form that links to a script which interacts with the database..., OR a PHP page that communicates with the database with the HTML and the form in it...., OR you can input all the information manually into the database yourself, via phpMyAdmin.so it's not a (php script saved as html document in my website folderand the database is NOT PHP.... and create a database (php) also saved in website folder because the database is not a file, nor is it PHP.To get your list, you make a PHP page that interacts with the database to get the records ("list items") and generates the HTML to be displayed in the browser.
Link to comment
Share on other sites

:) that's what I'm saying...it's still a PHP page outputting HTML, with all the PHP stuff happening first. which is not how you seem to understand it.you need to understand the distinctions amongst all of them.you make records (items in a "list") for a database table using an HTML page with a form that links to a script which interacts with the database..., OR a PHP page that communicates with the database with the HTML and the form in it...., OR you can input all the information manually into the database yourself, via phpMyAdmin.so it's not a (php script saved as html document in my website folderand the database is NOT PHP.... and create a database (php) also saved in website folder because the database is not a file, nor is it PHP.To get your list, you make a PHP page that interacts with the database to get the records ("list items") and generates the HTML to be displayed in the browser.
Thanks very much! That was my question since some time!
Link to comment
Share on other sites

:) that's what I'm saying...it's still a PHP page outputting HTML, with all the PHP stuff happening first. which is not how you seem to understand it.you need to understand the distinctions amongst all of them.you make records (items in a "list") for a database table using an HTML page with a form that links to a script which interacts with the database..., OR a PHP page that communicates with the database with the HTML and the form in it...., OR you can input all the information manually into the database yourself, via phpMyAdmin.so it's not a (php script saved as html document in my website folderand the database is NOT PHP.... and create a database (php) also saved in website folder because the database is not a file, nor is it PHP.To get your list, you make a PHP page that interacts with the database to get the records ("list items") and generates the HTML to be displayed in the browser.
Interacting the php page with the database is just a link?
Link to comment
Share on other sites

:) that's what I'm saying...it's still a PHP page outputting HTML, with all the PHP stuff happening first. which is not how you seem to understand it.you need to understand the distinctions amongst all of them.you make records (items in a "list") for a database table using an HTML page with a form that links to a script which interacts with the database..., OR a PHP page that communicates with the database with the HTML and the form in it...., OR you can input all the information manually into the database yourself, via phpMyAdmin.so it's not a (php script saved as html document in my website folderand the database is NOT PHP.... and create a database (php) also saved in website folder because the database is not a file, nor is it PHP.To get your list, you make a PHP page that interacts with the database to get the records ("list items") and generates the HTML to be displayed in the browser.
Where do I save this html list? I assume in the same folder of my php file!
Link to comment
Share on other sites

You can make static html list and it will always be like you've wrote in file.And if you save like that it's .html file, or .php which has:

<?PHPecho '  YOUR TABLES HERE';?>

But SQL works on totaly different way. PHP sends queries to MySQL database via SQL language and when MySQL receives command from PHP, it stores your data to some databases, tables, columns, rows etc. After it, you call your data same as you sent it. Just when sending you are using INPUT or UPDATE, but web calling you use SELECT.You even don't see your data anywhere in code. It's just a piece of code.Let's say you have:db_namedb_userdb_passdb_hostFirst you use command to connect to your database with db_host, db_user and db_pass.After, you select your db_name and select your database.Next thing, you are sending data to database like INSERT INTO some_table_in_database (something) VALUES (Some_value)Now, let's say you have more records stored in database.Like:12345Now you call your data like:SELECT something FROM some_table_in_databaseYou can store it to some variable and use loop and output them in selected format.

Link to comment
Share on other sites

Where do I save this html list? I assume in the same folder of my php file!
no, no, no.the list get's made by PHP after it gets some data back from the database. The point is that PHP generates it dynamically. So if at one point you have three records in the database, you will have a list of three items. Later, as you add, remove records, PHP will display the correct amount. The point is that you write the script that outputs the data. We've already given you examples and its all in the tutorials. If you read the tutorials about PHP or read/did any research about about programming in general, you would have learned about the most fundamental and basic of concepts; arrays, objects, loops and control structures, which is probably why you are having such a hard time understanding how PHP works, especially as it relates to generating dynamic content. You should really, really read the PHP tutorials more and practice programming in general before trying this stuff that you're doing. No offense, but if you think this is confusing/challenging/hard.....
Link to comment
Share on other sites

You're not going to have any HTML files, HTML alone doesn't do anything for you when you're trying to work with a database. All files will be PHP files. The PHP code may output HTML markup, but they aren't HTML files. HTML files don't "do" anything.

Link to comment
Share on other sites

I meant the html file to the php file!
I don't understand what you're trying to say. The PHP generates the HTML that needs to be outputted. I don't know how simpler/clearer/else to say it without actually copy/pasting in the tutorials themselves.
Link to comment
Share on other sites

I don't understand what you're trying to say. The PHP generates the HTML that needs to be outputted. I don't know how simpler/clearer/else to say it without actually copy/pasting in the tutorials themselves.
No, I mean the data for INPUT!I get confused!What is the list for INPUT and where do I save it? (html page with a form linked to php script?)What is the list for OUTPUT and where do I save it? (php file linked to database)?)
Link to comment
Share on other sites

Look at this thread, it contains all of the code to register and log in users. This includes forms that get submitted, and the data from the forms goes into the database as users. Someone can enter their email address and password to log in, and it gets that data from the login form and looks up the user in the database. It would be easy enough to also get all of the user information and list them all on a page also.http://w3schools.invisionzone.com/index.php?showtopic=12509

Link to comment
Share on other sites

No, I mean the data for INPUT!I get confused!What is the list for INPUT and where do I save it? (html page with a form linked to php script?)What is the list for OUTPUT and where do I save it? (php file linked to database)?)
read very slowly, all the answers are already here and in one post I've already given you....
What is the list for INPUT and where do I save it? (html page with a form linked to php script?)
you make records (items in a "list") for a database table using an HTML page with a form that links to a script which interacts with the database..., OR a PHP page that communicates with the database with the HTML and the form in it...., OR you can input all the information manually into the database yourself, via phpMyAdmin.
see, I said you use a form or phpMyAdmin. something explained very clearly in the tutorials. Forms have an action property that allows you to set a link to a script that will take the form data and process it (like for inputting into a database). so again, here are the links to readhttp://www.w3schools.com/html/html_forms.asphttp://www.w3schools.com/php/php_forms.asp
What is the list for OUTPUT and where do I save it? (php file linked to database)?)
To get your list, you make a PHP page that interacts with the database to get the records ("list items") and generates the HTML to be displayed in the browser.
so again, here is the link. when someone navigates to said page, it will process whatever you have written, and if part of that is HTML output, then it will be rendered in the browser. The HTML output can be structured in such a way with PHP that you can make into a list, a table, whatever you need it look like.http://www.w3schools.com/php/php_mysql_select.asp
Link to comment
Share on other sites

read very slowly, all the answers are already here and in one post I've already given you....see, I said you use a form or phpMyAdmin. something explained very clearly in the tutorials. Forms have an action property that allows you to set a link to a script that will take the form data and process it (like for inputting into a database). so again, here are the links to readhttp://www.w3schools.com/html/html_forms.asphttp://www.w3schools.com/php/php_forms.aspso again, here is the link. when someone navigates to said page, it will process whatever you have written, and if part of that is HTML output, then it will be rendered in the browser. The HTML output can be structured in such a way with PHP that you can make into a list, a table, whatever you need it look like.http://www.w3schools.com/php/php_mysql_select.asp
Thanks!
Link to comment
Share on other sites

Look at this thread, it contains all of the code to register and log in users. This includes forms that get submitted, and the data from the forms goes into the database as users. Someone can enter their email address and password to log in, and it gets that data from the login form and looks up the user in the database. It would be easy enough to also get all of the user information and list them all on a page also.http://w3schools.invisionzone.com/index.php?showtopic=12509
Thank you very much!
Link to comment
Share on other sites

This is funny.Eduard, whenever you have PHP code (<?php ...code... ?>) you must save the file as .php for it to work. The web server on knows to send that file to the PHP interpreter if it ends in .php. However, I don't see why you don't know this. The first page of the PHP tutorials says this:

What is a PHP File?PHP files can contain text, HTML tags and scriptsPHP files are returned to the browser as plain HTML PHP files have a file extension of ".php", ".php3", or ".phtml"
It seems like this is extremely clear._______________________________________________
It is not clear how a database works-I believe phpMyadmin isn´t mentioned!
That's because PHPMyAdmin isn't the database. It is just a PHP application that allows you to view, edit or delete the stuff in your databases. PMA (PHPMyAdmin) was created with PHP scripts. In other words, you can create something like PMA if you learn PHP/SQL well enough. When you use PMA, do you notice the box at the top of the page that says something like this: "SELECT * FROM your_table LIMIT 0, 30"? That is a SQL query.As explained on this page, SQL is the language used work with the database. PHP has functions (mysql_query, mysql_connect, etc) to work with MySQL (the database) using the SQL (the query language). I could say more, but I feel like I'm just saying the same thing that the tutorials say. We are happy to help you with your questions, but when we help, we want to see you understanding what we are saying.
Link to comment
Share on other sites

This is funny.Eduard, whenever you have PHP code (<?php ...code... ?>) you must save the file as .php for it to work. The web server on knows to send that file to the PHP interpreter if it ends in .php. However, I don't see why you don't know this. The first page of the PHP tutorials says this:It seems like this is extremely clear._______________________________________________That's because PHPMyAdmin isn't the database. It is just a PHP application that allows you to view, edit or delete the stuff in your databases. PMA (PHPMyAdmin) was created with PHP scripts. In other words, you can create something like PMA if you learn PHP/SQL well enough. When you use PMA, do you notice the box at the top of the page that says something like this: "SELECT * FROM your_table LIMIT 0, 30"? That is a SQL query.As explained on this page, SQL is the language used work with the database. PHP has functions (mysql_query, mysql_connect, etc) to work with MySQL (the database) using the SQL (the query language). I could say more, but I feel like I'm just saying the same thing that the tutorials say. We are happy to help you with your questions, but when we help, we want to see you understanding what we are saying.
I don´t understand your post! Of course I know that!
Link to comment
Share on other sites

I don´t understand your post! Of course I know that!
hey man, don't get mad at us for trying to help. You keep making the threads... you keep asking the same questions... we're stuck giving the same answer over and over and over again... (on top of there being a tutorial for everything we tell you... :))
Link to comment
Share on other sites

hey man, don't get mad at us for trying to help. You keep making the threads... you keep asking the same questions... we're stuck giving the same answer over and over and over again... (on top of there being a tutorial for everything we tell you... :))
Yes, I get mad when someone tells me the extension of a php file is .php, etc.!Also I wrote that the tutorials aren´t clear! If they were, I shouldn´t have to post so many questions!
Link to comment
Share on other sites

The terms "input" and "output" are extremely relative, even though as I hope you've understood, everything in programming can be reduced to them.Keep that in mind when asking about something's input and output. You need to be as specific as you can about it. "output of a database" is way too generic. Like everone else who has replied to you, I think you're still missing the whole point.Apache takes input from the user's HTTP request, and gives output back to the user in the form of an HTTP response.Before fully giving the output to the user, Apache starts PHP giving to it the HTTP request as input, and waits to get an HTTP response.Before fully giving the output to Apache, PHP could (if you instruct it to) give to MySQL input in the form of an SQL query, and MySQL could give the so called result set as output back to PHP. PHP could do this 0, 1, 2 or more times.After taking a result set as input from MySQL, PHP can use it for anything, like outputting something back to Apache based on whatever is the result set.THAT IS IT! ALL OF IT! Everything else about databases comes down to this. There's no way to "view" a database without a tool, there's no way to output anything other than a result set, and a result set is only being given to languages like PHP - it's not something "visual".A database is not something a client should view. They should view the output of your PHP file by making HTTP requests to the Apache server it is running on. Nothing more, nothing less.

Link to comment
Share on other sites

Yes, I get mad when someone tells me the extension of a php file is .php, etc.!
I just said that in response to your statement that you were putting your scripts in HTML files. Boen explained the whole process very clearly. Previously, I was going to pull up one of those graphic illustrations of HTTP requests, but I couldn't find a good image. Boen, didn't you link to an image of the whole process once? I can vaguely remember it. Hmm, maybe it was Synook...
I don´t understand your post! Of course I know that!
How can you know something you don't understand? :)
Link to comment
Share on other sites

Ok this made me smile, guys lets try not to run eduardchile off the forum! :). At this point I don't think we want another w3fools. Eduard I would strongly stress you take the time to focus and properly understand one aspect of web development at a time. It is tempting to "learn web development in 21 days etc" but jumping topics like that seems to be confusing you. You may want to invest in some ebooks and wikipedia time as well.

Link to comment
Share on other sites

Archived

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


×
×
  • Create New...