grigori Posted February 12, 2009 Share Posted February 12, 2009 Hello everyone I'm George(Giorgos in greek), and i'm 16, these are my first steps in coding, since i am learning everything from beginning, so don't be rough to me :) To the point now, i have some script examples, which i'm using only for learning purpose on localhost. The thing is that i'm trying to make an english-greek dictionary, using ajax/mysql/php, but just with small amount of words... I have managed to work but only with one table, and there are two tables, one for eng-gr, and another one for gr-eng translation. So my question is, how can i get translation, according to language i type in field, without previously selecting relation between languages. db=test, table1, has 3 columns: id, eng, gr table2, also 3 columns: id, gr, eng and the script: <?php $db_host="test"; $db_name="test"; $username="1234"; $password="1234"; $db_con=mysql_connect($db_host,$username,$password); $connection_string=mysql_select_db($db_name); mysql_connect($db_host,$username,$password); mysql_select_db($db_name); mysql_query("SET NAMES 'utf8'"); ?> <?php $searchq = strip_tags($_GET['q']); $getRecord_sql = 'SELECT * FROM `test` WHERE `eng` LIKE "'.$searchq.'%"'; $getRecord = mysql_query($getRecord_sql); if(strlen($searchq)>0){ echo '<ul>'; while ($row = mysql_fetch_array($getRecord)) {?> <li><a href="#"><?php echo $row['eng']; ?> <small><?php echo $row['gr']; ?></small></a></li> <?php } echo '</ul>'; ?> <?php } ?> Thank you in advance Quote Link to comment Share on other sites More sharing options...
fenway Posted February 15, 2009 Share Posted February 15, 2009 I don't understand. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.