EDIT:
Just saw your post.
Ok... you're making this WAY too complex.
You don't need php. Forget about it.
You just need notepad/word and do a find/replace to put that in there. couldn't be easier. Really.
FIND: INSERT INTO
REPLACE WITH: <query>INSERT INTO
FIND: ');
REPLACE WITH: ');</query>
You're done. Be happy.
//EDIT
mysql results are retrieved using mysql queries.... a query is a type of request/database command that results in... well... results.
(for this example, I'll assume we're using a database for a forum such as this one)
That would result in the membername of the first person to get an ID, likely the admin, etc.PHP Code:mysql_query("SELECT `name` FROM `members` WHERE `id`='1'")
SELECT means... select/grab/get/find/retrieve. `name` means it will select the `name`... not the ID, not the IP address, etc.
FROM specifies the table in the database... members? topics? private messages? etc...
WHERE is a condition and optional. You can specify that if you want to find a particular item, or sets of items, like WHERE `group` = "admin".
Here's what to do with the result:
This means...PHP Code:$result = mysql_query('somethinghere');
while ($row = mysql_fetch_assoc($result)) {
echo $row['name']."\n";
}
The first part sets $result to the value of what is returned from the query. It's some strange form of data that can't be used directly.
We use the function mysql_fetch_assoc, just a function, don't be alarmed, to make that into an array.
$row = mysql_fetch_assoc($result) sets the value of ONE row of the result from the query to the $row array.
If you had more than one result from the mysql query, you would be able to access all of those values in it.
$row['fieldname'] is the general syntax for a value in the array at tha point, in this case, name... $row['name']
So... to recap, so you're not lost: 1. ask the database for results that match certain requirements. 2. Take those results and place them into a variable.
The next step is to use a while loop. This will keep looping/repeating until the rows are over. It's not "while this is equal to this" but literally "while this is set to this".
Since there are a limited number of rows returned (even if that is a thousand, like you'd be dealing with), then it would fail after the rows are used up. therefore, it loops through all of the rows returned from the database.
echo is a general command meaning print/output/write to the outputted html.
echo $row['name']."\n"; means...
1. print the value of the name from the database, then 2. add a line break (
\n is a special line break character in php, long story).
and that's it.
You may be a bit confused, but it'll make sense.
That's why I gave you a link.
Click. Read. Try. It'll work out. that's how I learned. Very easy to follow step by step guide. Heck, it's almost boring in parts it's so easy ;)
Also, a general question... you may not even need to do this. do you have a text document containing all this information? It looks to me like you have a text backup, which is basically a set of mysql commands to recreate the database, with INSERT INTO, and UPDATE and such.
If that's the case, then FORGET everything about php and all that.
You just need to use php to interpret the data, or even use another language. Find/replace in notepad/word/etc. might be able to help.
I'm still not quite sure what you're doing.
