Hi, > Hi All > > I know how to open, read & write to files using Php. > > But how can you write some content to a particular place in a file, Not > the start or end but say the middle some where. > > Example: > > Basic html file > > <html> > <head> > <title></title> > </head> > <body> > > Write my stuff here!!! > > </body> > </html> > > This eventually will relate to a db so I hope its not completely of > topic. >
It doesn't seam to be database related... But any way.... Two solutions: 1st solution( recommended ): - read the entire file into a string( fread, ) - do a string relacement, ie: replace the string "<body></body>" with the string "<body>what you want</body>". 2st solution: - use fseek function to place the file "pointer" where you want - write the string to the file Miguel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php