<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$getLima=$_POST['Onoma'];
include "connect.php";


$rsSelectOnomata=mysql_query("SELECT * FROM titloslimmatos WHERE LimmatikosTypos='$getLima'");
//$result=mysql_query($query); 



while($rsRow=mysql_fetch_assoc($rsSelectOnomata)) {

echo $rsRow[titloslimmatos.LimmatikosTypos];
$rsRow[titloslimmatos.MerosLogoy];
$rsRow[titloslimmatos.YfologikoEpipedo];
$rsRow[titloslimmatos.GlwssikoEpipedo];
//$rsRow[extralimmatikoitypoi.ExtraLimmatikosTypos];
//$rsRow[extralimmatikoitypoi.YfologikoEpipedo];
//$rsRow[Simasia.XrisiLeksis];
//$rsRow[synonimo.Synonimo];
//$rsRow[synonimo.Example];
//$rsRow[antitheto.Antitheto];
//$rsRow[antitheto.Example];
}


}
else {
?>
<html>
<body bgcolor="#FFFFCC">
<h3><center><b>Δώστε το λήμμα που ψάχνετε</b></center></h3>

<table>
<form method="post" action="<? echo $PHP_SELF ?>">
<input name="onoma" type="text">
<input type="Submit" name="set" >
</form>
</table>

</body>
</html>
<?
}
?>

Recommended Answers

All 13 Replies

Might help to state what the problem is. I don't want to sit here looking through your code without knowing what I am looking for.

Also, use code tags.

i want to make a site on line dictionary, i use the programm xampp,
when i run this code (localhost) and insert a word that exist in my database the result is a blank page...
can someone help me? its emergency!

also sometimes when i run this code it's show me:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\index.php on line 12

Print and execute the query in phpmyadmin / mysql console. Check the error message.
OR
Use

$rsSelectOnomata=mysql_query("SELECT * FROM titloslimmatos WHERE LimmatikosTypos='$getLima'") or die(mysql_error());

This will print the error message on failure. This is good for testing purpose (and not in the production environment as it exposes your table structure and all that!)

What nav33n said.

Also, if you want to search for values which I guess you will do for a dictionary, look into the LIKE operator for your SQL query.

index.php

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$getLima=$_POST['Onoma'];
include "connect.php";


$rsSelectOnomata=mysql_query("SELECT * FROM titloslimmatos WHERE LimmatikosTypos='$getLima'") or 

die(mysql_error());
$result1=mysql_query($query); 



while($rsRow=mysql_fetch_assoc($rsSelectOnomata)) {

echo $rsRow[titloslimmatos.LimmatikosTypos];
$rsRow[titloslimmatos.MerosLogoy];
$rsRow[titloslimmatos.YfologikoEpipedo];
$rsRow[titloslimmatos.GlwssikoEpipedo];
//$rsRow[extralimmatikoitypoi.ExtraLimmatikosTypos];
//$rsRow[extralimmatikoitypoi.YfologikoEpipedo];
//$rsRow[Simasia.XrisiLeksis];
//$rsRow[synonimo.Synonimo];
//$rsRow[synonimo.Example];
//$rsRow[antitheto.Antitheto];
//$rsRow[antitheto.Example];
}


}
else {
?>
<html>
<body bgcolor="#FFFFCC">
<h3><center><b>Δώστε το λήμμα που ψάχνετε</b></center></h3>

<table>
<form method="post" action="<? echo $PHP_SELF ?>">
<input name="onoma" type="text">
<input type="Submit" name="set" >
</form>
</table>

</body>
</html>
<?
}
?>

-------------------------------------------------------------
connect.php

<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

when i run the file index.php the result was:
Connected successfully No database selected

any idea please?

Yeah. You don't have mysql_select_db("Databasename"); in your script.

Why oh why did I even bother writing the FAQ that answers this very issue if no one is going to read it? It never stops baffling me when I see these posts.

sorry.. that was by mistake...

the code of connect.php is:

<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';

mysql_select_db("annadb");

//mysql_close($link);
?>

i run again the file index.php and the result was:
Connected successfully

whay it doesn't show me the word that i insert?

Why oh why did I even bother writing the FAQ that answers this very issue if no one is going to read it? It never stops baffling me when I see these posts.

;) Newbies prefer to skip the first post I believe ! Sigh.

sorry.. that was by mistake...

the code of connect.php is:

<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';

mysql_select_db("annadb");

//mysql_close($link);
?>

i run again the file index.php and the result was:
Connected successfully

whay it doesn't show me the word that i insert?

Okay! Now I am totally lost. Where are you inserting the values ? Check this link. I hope that link will answer your question.

And pleaseee(eee). Wrap your code in [code=php] code here [/code] tags.

Line 16 has echo, but lines 17 to 26 not. if php is in safe mode the error not appear, only show a blank page. May be this help.

Line 16 has echo, but lines 17 to 26 not. if php is in safe mode the error not appear, only show a blank page. May be this help.

This actually isn't an error, it just won't do anything. Those are completely valid statements (like I said, they just don't do anything)

You help me very much...
Thanks a lot all of you....!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.