Jump to content

select.php in root folder?


eduard

Recommended Posts

My select.php file do I also have to store in my root folder?
Are the files using it/linking to it in your root folder, without using an extended path? If yes, then yes.
Link to comment
Share on other sites

My select.php file do I also have to store in my root folder?
How many times do we have to tell you that all files relevant to your website must be in your webroot? Every file....always...Especially PHP files....
Link to comment
Share on other sites

My select.php file do I also have to store in my root folder?
For the final time. PHP is a server-side language. IT MUST BE RUN IN A SERVER ENVIRONMENT. this is the exact reason why you downloaded MAMP for testing, to emulate a server. And if you still don't get that, then we have told you repeatedly that all of your web files need to be in the webroot folder (/Applications/MAMP/Htdocs). ALL OF THEM. why are you still even asking this question!? :)
Link to comment
Share on other sites

How many times do we have to tell you that all files relevant to your website must be in your webroot? Every file....always...Especially PHP files....
Sorry, it´s still early!
Link to comment
Share on other sites

Sorry, it´s still early!
early today, but not over the past few weeks of telling you the same thing already :)
Link to comment
Share on other sites

early today, but not over the past few weeks of telling you the same thing already :)
Yes, but over the past few months I was sleeping, now I´m awake (later!)But I have another question to you:As you already noticed, I followed your order to make something of a database to show on my website!So ny question now is how do I get the html form, the insert query and the select query on my website? By links? (I assume!)
Link to comment
Share on other sites

well. just the same way you have them on your local machine. You upload the files to your host (in the same folder where all your other website files are) and then you can just make a link to the form from a page already on your site. So somewhere on your main page for example, you would have this:

<a href="form.html">Click me For a database demo</a>

Now someone can visit that page and you can give them a form to fill out to add stuff to the database You could also include the SELECT code in form.html (by making it a PHP page) that displays the form and will also show the results of the database. In this case you could have the form appear at the top, and then below that show what's already in the database.When someone fills out the form, and hit's submit, you could have your form handler page (insert.php or whatever you're calling it) redirect the user back to the form page so that they can fill out the form again. But, in this cycle, the latest product added to the database would also be seen, so they could see all the stuff they add on one page.That's just one way to do it, however.

Link to comment
Share on other sites

well. just the same way you have them on your local machine. You upload the files to your host (in the same folder where all your other website files are) and then you can just make a link to the form from a page already on your site. So somewhere on your main page for example, you would have this:
<a href="form.html">Click me For a database demo</a>

Now someone can visit that page and you can give them a form to fill out to add stuff to the database You could also include the SELECT code in form.html (by making it a PHP page) that displays the form and will also show the results of the database. In this case you could have the form appear at the top, and then below that show what's already in the database.When someone fills out the form, and hit's submit, you could have your form handler page (insert.php or whatever you're calling it) redirect the user back to the form page so that they can fill out the form again. But, in this cycle, the latest product added to the database would also be seen, so they could see all the stuff they add on one page.That's just one way to do it, however.

Thanks! So, you mean making another html form including the script select.php?
Link to comment
Share on other sites

no, just add the SELECT code to the form.html page (which means you have to give it a .php extension) and then output the contents of the result on the page somewhere. before/after the form, doesn't really matter much.

Link to comment
Share on other sites

no, just add the SELECT code to the form.html page (which means you have to give it a .php extension) and then output the contents of the result on the page somewhere. before/after the form, doesn't really matter much.
So there is 1 html form, not 2! And the extension changes from html in php?
Link to comment
Share on other sites

So there is 1 html form, not 2! And the extension changes from html in php?
yes, that is one possible implementation. One PHP page that can show the (HTML) form to be submitted, and also the output (an HTML table) of the result of the SELECT. You could also incorporate the INSERT script into this as well, for an all inclusive PHP page that does everything, but I think teaching you to mix scripting and HTML output in and of itself is a great enough challenge for now. Adding the complexity of mixing forms and form submission into one page is best saved for another thread somewhere down the road.
Link to comment
Share on other sites

How many times do we have to tell you that all files relevant to your website must be in your webroot? Every file....always...Especially PHP files....
All of the webroot folder I understand! (there I safe since some months all the files of my website)What I don´t understand is e.g. if I want to RUN a php script how do I do that (I tried to RUN it with Safari!)?
Link to comment
Share on other sites

All of the webroot folder I understand! (there I safe since some months all the files of my website)What I don´t understand is e.g. if I want to RUN a php script how do I do that (I tried to RUN it with Safari!)?
in exactly the same way we've told you before.1) Make sure MAMP is running.2) make sure all your files are in the webroot3) use your browser to open the (php) file.* *scripts can be directly run from the browser (without having a form submit to them) as long as conditions 1 and 2 exist. PHP files will only run if conditions 1 + 2 are met. This cannot be emphasized enough, so I hope you learn it/write it down/staple it to your forehead/etc. if you have problems with step 3, then (as has also been explained before many times) include the code, the actual steps you are taking, and any errors/messages that you see. we cannot guess what the problem is and with your history, it's probably something stunningly simple that you've overlooked that you are not doing (wrong url/path, not putting folders in the webroot/etc) that we cannot simply take for granted.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...