MoMoMajor Posted July 21, 2009 Share Posted July 21, 2009 Hi everyone, Ok so I am working on a small social network of sorts and I am having a little trouble linking a page to mysql. So far I have a registration form that stores info in a database, creates a directory (www.mywebsite/usersdirectory) and copies a generic index.php into the aforementioned directory. I am having trouble connecting the saved information in mysql to the page that was generated. I don't know how to go about linking the information from my mysql table (page_id, page_description, page_title) to the actual blank page that was generated. I would greatly appreciate any help. Quote Link to comment Share on other sites More sharing options...
MoMoMajor Posted July 21, 2009 Author Share Posted July 21, 2009 ok new question: how do i edit a php file from a php file? i would like to hardcode the index.php file before/after it is copied with the data from mysql Quote Link to comment Share on other sites More sharing options...
trq Posted July 21, 2009 Share Posted July 21, 2009 fopen fwrite. Quote Link to comment Share on other sites More sharing options...
gizmola Posted July 21, 2009 Share Posted July 21, 2009 ok new question: how do i edit a php file from a php file? i would like to hardcode the index.php file before/after it is copied with the data from mysql That doesn't really make sense. The PHP script is not equivalent to the ultimate html that is returned. Writing a .php file would not be of any advantage. Quote Link to comment Share on other sites More sharing options...
gizmola Posted July 21, 2009 Share Posted July 21, 2009 Ok, I think I understand what you are meant -- you're wanting to do a config file. See Thorpe's answer. Keep in mind that most sites will have permissions that won't allow you to write out files, so most scripts do permissions checks and indicate if this is an issue, and then provide the information so it can be hand editted if desired. Quote Link to comment Share on other sites More sharing options...
MoMoMajor Posted July 21, 2009 Author Share Posted July 21, 2009 ok new question: how do i edit a php file from a php file? i would like to hardcode the index.php file before/after it is copied with the data from mysql That doesn't really make sense. The PHP script is not equivalent to the ultimate html that is returned. Writing a .php file would not be of any advantage. yep you're right, no idea what i was thinking. I have no idea what to do from here. information is in mysql and I have a blank page generated with no way of connecting the two. there is obviously a way to do this since many sites work this way I just don't know what it is yet. Quote Link to comment Share on other sites More sharing options...
MoMoMajor Posted July 21, 2009 Author Share Posted July 21, 2009 alright thanks for the help ill look into those functions Quote Link to comment Share on other sites More sharing options...
MoMoMajor Posted July 21, 2009 Author Share Posted July 21, 2009 Ok I am still having trouble. I think my original question was a bit vague so I will put it to you like this: Say myspace was running on php/mysql. How do they go about taking the information from their mysql database and applying it to the user profile page. What lets the database and/or the index.php file know what what information from the mysql tables go where. Quote Link to comment Share on other sites More sharing options...
trq Posted July 21, 2009 Share Posted July 21, 2009 They wouldn't have a different index page for each user fullstop. All user profile pages would be the same script, they just get different information from the database based on what users profile is called. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.