Forum Moderators: coopster

Message Too Old, No Replies

get data from a file.

get data from a file.

         

azulus

4:13 am on Sep 13, 2010 (gmt 0)

10+ Year Member



hi, i have this code that saves tow input text a database, this script i run with admin.php. it looks like this:

<input type=text name="eng">

<input type=text name="spa">

<input type=submit name=sm value="Submit">

it's an english-spanish dictionary! so when i enter a word in english "eng" and a word in spanish "spa" this script saves those words in database "eng" "spa"
$eng=$_POST['eng'];
$spa=$_POST['spa'];
$sql="Insert into words(eng, spa) values('".$eng."','".$spa."')";
$res=mysql_query($sql,$link);
//header("Location: admin.php");
?>
<script language=Javascript>window.location="admin.php";</script>
<?

}
else
echo("Insert data !");

the index.php

<input type=text name="word">
<input type="submit" name="sbm2" value="Translate" />
$sql="select * from words where eng like '".$word."'";
//echo($sql);
$result=mysql_query($sql,$link);
if(@mysql_num_rows($result)!=0)
{
while($rows=mysql_fetch_array($result))
{
$spa=$rows["spa"];
// $fren=$rows["fren"];
}
echo("Word<b>$word</b> in Berber is : <b>$spa</b><br>");
so when i type an english word ="word" $sql uses "select * FROM ' ' WHERE '' LIKE '".$word."'"; to get the corespondent spanish word.

for some reason my database table can't support more then 127 word!
i'm trying to upload words from file instead!

like file.txt
hello, hola
water, agua
table, tabla
i can write the file, but i can't get it with index.php.

any idea, tips about this will be appreciated

brotherhood of LAN

4:26 am on Sep 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to the forums azulus

for some reason my database table can't support more then 127 word!


It sounds like you are using a TINYINT SIGNED column for a primary key on that particular database table (TINYINT SIGNED has a range of -127 to 127)

You should try changing it to INT UNSIGNED, that would give the table a capacity for over 4 billion unique records.

azulus

3:22 pm on Sep 13, 2010 (gmt 0)

10+ Year Member



you got it, it worked well. thanks a lot :)