0
<?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>
<?
}
?>
5
Contributors
13
Replies
15
Views
7 Years
Discussion Span
Last Post by anna05
0

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.

0

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

0

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!)

0

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.

0

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?

0

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.

0

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?

0

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.

0

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.

0

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.

0

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)

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.