Forum Moderators: coopster
i have a text file with this (for example):
--------------------------------------------------------------------
blitzztriger [#*$!xx] - time : 1
hello - ( 47) 52 40
30,000 (+600) 50% 20,000 (+400) 50%
hello2 - ( 48) 102 40
35,000 (+650) 100% 50,000 (+200) 90%
--------------------------------------------------------------------
the ideia is to :
"name" --->column 1(line1)the dump will be:blitzztriger
"hello"--->column 2(line1) the dump will be:hello (hello its a name)
"( 47)"--->column 3 (line1)the dump will be:47
"( 52)"--->column 4 (line1)the dump will be:52
"30,000"--->comumn 5(line1)the dump will be: 30000 (number)
"(+600)"--->column 6(line1)the dump will be : 600
"50%"------>colum 7(line1) the dump will be: 50
and so on...
"name" --->column 1(line2)the dump will be:blitzztriger
"hello2"-->column 2(line2) the dump will be:hello2 (hello its a name)
"( 48)"--->column 3 (line2)the dump will be:48
"(102)"--->column 4 (line2)the dump will be:102
"35,000"--->comumn 5(line2)the dump will be: 35000 (number)
"(+650)"--->column 6(line2)the dump will be : 650
"100%"----->colum 7(line2) the dump will be: 100
and so on...
then the dumped values should enter mysql DB.
thanks in advance
I see you haven`t had a response on this one. Did you find anything out yourself? I would guess you`ll need to read the lines from the text file and then manipulate each line by exploding the data and extracting the data you need. A couple of functions to look into are:
file [php.net]
explode [php.net]
dc
maybe no one understood what i wanted , let me try again:
Here is my code for a textfield input:
<?php
$conexao = mysql_connect("localhost", "root", "12345")
or die ("Error connecting to db");
$db = mysql_select_db("testdb")
or die ("error selecting db");
mysql_query("INSERT INTO tabela1 values($value)");
/*
* mounts the query in the colunm "black pieces" for example
*/
$sql = "INSERT INTO tabela (
black pieces
) VALUES (
//lalala its the textfield name
'".$_POST['lalala']."'
)";
/*
* executes the query
*/
$sql = mysql_query($sql)
or die ("there was a mistake");
?>
<h1>INSERT work LIST</h1>
<form action="inserir.php" method="post">
<label for="texto"></label>
<textarea name="lalala" id="text" rows="10" cols="30" />
</textarea><br />
<input type="submit" value="insert">
</form>
------------------------------------------------------------
ok , the kind of information that ppl use to input in the textfield there :
blitzztriger [nothing] - time : 1
hello - ( 47) 52 40
30,000 (+600) 50% 20,000 (+400) 50%
hello2 - ( 48) 102 40
35,000 (+650) 100% 50,000 (+200) 90%
------------------------------------------------
lets imagine that the "black pieces" are the values: 20,000 for hello (hello its the name of the car, but can be other name,so its a variable to) and 50,000 for hello2 ; how can i input them in the db?
ex of the db:
worker........¦car.......¦black pieces
blitzztriger...¦hello.....¦20000
blitzztriger...¦hello2...¦50000
i just need 1 example for the "black pieces, the rest i will try to do it myself :)