Capriciu Posted June 11, 2012 Report Posted June 11, 2012 (edited) Un mic ajutor va rogAm un mic dictionar in care as dori ca atunci cand scriu un cuvant (care se afla in baza de date) la search-ul de la un site sa imi returneze definitia cuvantului. La fel daca introduc sinonimul acestuia.Nume tabel: cuvinteNumar coloane : 6coloana 1 : numarul corespunzator cuvantului 1-60 coloane 2: cuvantcoloana 3: cuvant_englezacoloana 4: definitiecoloana 5: definitie_englezacoloana 6: sinonimAm pus descrierea deoarece vad ca nu se incarca pozaMultumesc Edited June 11, 2012 by aelius cand veti invata sa folositi imageshack si sa nu puneti link catre un document html in tag-ul de imagine Quote
totti93 Posted June 12, 2012 Report Posted June 12, 2012 (edited) <html><head> <title>Dictionar</title></head><body><form action="" method="post"> <input type="text" name="search" /> <input type="submit" value="Cauta" /></form><?phpif (isset($_POST["search"])) { include("connection.inc.php"); $search = $POST["search"]; $search = mysql_real_escape_string($search); echo "<table>"; echo "<tr><td>Cuvant</td><td>Cuvant engleza</td><td>Definitie</td><td>Definitie Engleza</td><td>Sinonim</td></tr>"; $result = mysql_query("SELECT * FROM `dictionar` WHERE cuvant LIKE '%$search%' OR sinonim LIKE '%$search%';"); while ($row = mysql_fetch_array($result)) { $cuvand = $row["cuvant"]; $cuvant_engleza = $row["cuvant_engleza"]; $definitie = $row[definite"]; $definitie_engleza = $row["definitie_engleza"]; $sinonim = $row["sinonim"]; echo "<tr><td>$cuvant</td><td>$cuvant_engleza</td><td>$definitie</td><td>$definitie_engleza</td><td>$sinonim</td></tr>"; } echo "</table>";}?></body></html>Nu a fost testat. Dai o bere pentru asta. Edited June 12, 2012 by totti93 Quote
Cril Posted June 12, 2012 Report Posted June 12, 2012 <html><head> <title>Dictionar</title></head><body><form action="" method="post"> <input type="text" name="search" /> <input type="submit" value="Cauta" /></form><?phpif (isset($_POST["search"])) { include("connection.inc.php"); $search = $POST["search"]; $search = mysql_real_escape_string($search); echo "<table>"; echo "<tr><td>Cuvant</td><td>Cuvant engleza</td><td>Definitie</td><td>Definitie Engleza</td><td>Sinonim</td></tr>"; $result = mysql_query("SELECT * FROM `dictionar` WHERE cuvant LIKE '%$search%' OR sinonim LIKE '%$search%';"); while ($row = mysql_fetch_array($result)) { $cuvand = $row["cuvant"]; $cuvant_engleza = $row["cuvant_engleza"]; $definitie = $row[definite"]; $definitie_engleza = $row["definitie_engleza"]; $sinonim = $row["sinonim"]; echo "<tr><td>$cuvant</td><td>$cuvant_engleza</td><td>$definitie</td><td>$definitie_engleza</td><td>$sinonim</td></tr>"; } echo "</table>";}?></body></html>Nu a fost testat. Dai o bere pentru asta.Ai un mic typo (la o prima vedere):...$cuvand = $row["cuvant"];...echo "<tr><td>$cuvant</td>....Dar cred ca poate sa repare si el greseala Quote
totti93 Posted June 12, 2012 Report Posted June 12, 2012 Am spus ca nu l-am testat, nu am nici timp, trebuie sa ma duc imediat la proba orala de romana.Oricum mersi! Quote