Jump to content
Capriciu

search.php

Recommended Posts

Posted (edited)

phpv.png

Un mic ajutor va rog

Am 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: cuvinte

Numar coloane : 6

coloana 1 : numarul corespunzator cuvantului 1-60

coloane 2: cuvant

coloana 3: cuvant_engleza

coloana 4: definitie

coloana 5: definitie_engleza

coloana 6: sinonim

Am pus descrierea deoarece vad ca nu se incarca poza

Multumesc

Edited by aelius
cand veti invata sa folositi imageshack si sa nu puneti link catre un document html in tag-ul de imagine
Posted (edited)


<html>
<head>
<title>Dictionar</title>
</head>
<body>
<form action="" method="post">
<input type="text" name="search" />
<input type="submit" value="Cauta" />
</form>
<?php
if (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 by totti93
Posted

<html>
<head>
<title>Dictionar</title>
</head>
<body>
<form action="" method="post">
<input type="text" name="search" />
<input type="submit" value="Cauta" />
</form>
<?php
if (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 :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...