![]() |
|
#1
|
||||
|
||||
PHP Scripthow would I add the text file to a MySQL database?
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
||||
|
#2
|
||||
|
||||
|
i have never done this b4 so all i can do is post a URL...
http://www.mysql.com/doc/en/LOAD_DATA.html ...something to read in bed, with laptop and wireless network no doubt. Share what you find out. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
Wouldn't it be easier to save the PHP script in a text file, and put the filename of the script into the database.
Certainly having a column in the database that can expand dynamically (I think it's a BLOB) to fit whatever goes in, really slows things down. And with a large table full of scripts, a simple SELECT statement will take a while. And the database will end up taking up more space than if you'd just saved each file to the disk directly. But I'd be curious to see how you get on. So do keep us informed Garth Farley |
|
#4
|
||||
|
||||
|
reading Garth's reply, I realise that my reply was about something else entirely.
I had assumed you were talking about loading a text file db into MySQL... go figure! Yeah, like Garth said, you can do either: load the text directly into a table load just filename into a table; and include() it load the php filename into the table; and eval() the file depending what you decide, then you can insert the data into mysql PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
||||
|
||||
|
Need alittle help please, I'm still tring to understand how this is going to work I need a few more ideas. I need a PHP script that will search thourgh a folder on the server for a text file and display the link to that file to the user. Like if I search for cheats for gameA it will display a link to the txt or html file that is for the gameA cheats. The script will only need to handle two options Cheats and FAQs for now. I need alittle help in the direction I need to go to get this script started.
Thanks __________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#6
|
||||
|
||||
|
why don't you start with something simpler, just work on a script to list your FAQ and Cheats alphabetically - then... tackle a keyword 'search' script.
If you decide to go that way, attach a sample of the file / text that you want to include in your pages and we can discuss the next step. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#7
|
||||
|
||||
|
Quote:
If you want to save a PHP script in the DB you wouldn't use a BLOB type field as BLOB is for binary data such as images. I would personally use largetext, which is what i use on my site for the news. I am not sure of the maximum size of a largetext field but I know it's pretty darn big and can probably handle most php scripts with little or not problems. As for handling the slowdown issue that's easy as well. Simply make sure you have a ID for each then have your select statements use the ID, make sure it's index and unique, that way select calls to the DB won't slow it down because they will only pull the whole row when the right criteria is met, like: PHP Code:
This will only pull the row with ID 1500 from the database the rest of the function only uses the ID column which should only be an int, if you have a HUGE site with TONS of rows in the DB maybe ID could be a bigint...good idea to have ID set to unique, index, auto_increment and I usually make mine primary as it is where I do 99% of my queries. |
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP script to show last referrer url and top referrer to your site | jrobbio | MySQL / PHP Forum | 6 | 22-May-2006 01:06 |
| [script] Password Protect web pages/site using PHP and MySQL | JdS | PHP Code Library | 0 | 23-Jul-2003 10:02 |
| All the big PHP script collections that matter | jrobbio | MySQL / PHP Forum | 5 | 06-Jun-2003 16:14 |
| Have an email sent to you when Google crawls your PHP site | jrobbio | MySQL / PHP Forum | 5 | 26-Feb-2003 22:38 |
| VALIDATING file types on an PHP upload script? | JdS | MySQL / PHP Forum | 0 | 02-Jan-2003 07:58 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The