tywiggle Posted December 13, 2008 Share Posted December 13, 2008 Hello, I have a rather basic knowledge of PHP and SQL. I am creating a large number of static web pages. I currently have to change the variable 'pattern' by hand and then save the file manually as 'pattern'. I can easily do a number of pages an hour but it is very tedious. Is there a way to automatically add the variable and then save the page as 'pattern'.php? Here is the code I have been using: <?php $cxn=mysqli_connect ("localhost", "xxxx", "yyyy"); mysquli_select_db($cxn, "zzzz"); $query="select pattern, a, b, c, d, e from 'database' where pattern='pattern'";(<--this is the variable I need to change automatically) $result=mysqli_query($cxn, $query); $row=mysqli_fetch_assoc($result); extract($row); ?> After 'pattern' is automatically inserted into the code I need to automatically save the page as 'pattern'.php and then move on the the next 'pattern' in the database. Another question: Is it possible to automatically convert existing php webpages to HTML pages and erase a date display from the code (the date shows but never changes). I have also been doing this manually and it seems there has to be a better way. Any suggestions or tutorials someone can point me to would be greatly appreciated. Thank you, Ty, the cross-eyed guy with worn out typing fingers. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 13, 2008 Share Posted December 13, 2008 $query="select pattern, a, b, c, d, e from database where pattern='$pattern'";(<-- Just simply make it a variable and set it somewhere before this executes. Quote Link to comment Share on other sites More sharing options...
champoi Posted December 13, 2008 Share Posted December 13, 2008 Another question: Is it possible to automatically convert existing php webpages to HTML pages and erase a date display from the code (the date shows but never changes). I have also been doing this manually and it seems there has to be a better way. why convert it to html? you can have the same benifits of using an html with a php, only php is better since you can do more. If it's about that date display, just delete the code related to it, Quote Link to comment Share on other sites More sharing options...
chronister Posted December 13, 2008 Share Posted December 13, 2008 For the date, you can use the date() function. It will automatically update for the current date or whatever date you set it to. e.g. <?php echo date('m/d/y', time()); ?> Will echo the format as 12/13/08 and will change each day. Quote Link to comment Share on other sites More sharing options...
tywiggle Posted December 15, 2008 Author Share Posted December 15, 2008 To further clarify: I have 3000 values to plug into the variable named 'pattern'. After the value is plugged in, I need to automatically save the page as 'pattern.php'. Any suggestions? Not to stir the pot, but I really need to make the php pages into HTML. This is for specific SEO purposes where a specific format of HTML is absolutely required. Any suggestions? Quote Link to comment Share on other sites More sharing options...
chronister Posted December 16, 2008 Share Posted December 16, 2008 does the data ever change? I mean, once it is written to the page and saved.. will it change? What your asking to do is basically simple... and the saving to html is no problem. It sounds like your going to have 3000 pages called pattern.php, or are you wanting to use pattern.php to generate the html? Where are the 3000 patterns stored? Are they in a text file, xml or where do you get them from right now? Those are the first things to determine. Nate 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.