-3

I am a beginner so please be patient with me. I have a website and a database and im looking to achieve the following...

A user loads example.com, whilst loading the html page an embedded php script grabs some data from an sql db, prints the data into the page and the user gets shown an sql value within the loaded html page. How is this possible?

I have searched all over the net but keep getting examples that echo onto a php page, not an html page. Thanks in advance.

user4163554
  • 51
  • 10
  • show us what you have done so far. – GabrielVa Feb 24 '16 at 19:06
  • It sounds like you what you actually want to do is have your html page make a Ajax request to get data from your php script. – jimi dough10 Feb 24 '16 at 19:07
  • @GabrielVa - I haven't anything to show! I was thinking my php and sql learning was going well until this problem arose. I just couldnt find anywhere to start learning from. I have tried all sorts of keywords in google but havent found anything. I am gonna havr a quick look at the link thats been provided though. Wont be long. – user4163554 Feb 24 '16 at 19:18
  • Start with the basics, then try something like this: https://www.youtube.com/watch?v=M-X--_0Z6xs – GabrielVa Feb 24 '16 at 19:26
  • As for the downvoters, no matter how backwards or misunderstood a question maybe, I have looked for 2 days for an answer and have now found what I wanted to know. Had I found this then, I simply wouldnt have needed to ask. For all contributors, thanks for the effort, Ive got an answer and will be looking into Ajax. Ta. – user4163554 Feb 24 '16 at 19:34

1 Answers1

1

You will need to change the extension of the file to .php to run any php code on the page

If you cant you can look into AJAX but the page called through ajax will have to be php to run php

PhizoR
  • 36
  • 2
  • Just been readimg through some tutorials and Ajax certainly sounds promising. Just out of curiosity... I once made a website, coded a little javascript and ended up giving up as my browser always started kicking up activex control warnings that I never realy understood. Ajax, as I have been reading is a form of javascript, will I encounter the same problems with warnings? Thanks. – user4163554 Feb 24 '16 at 21:39