Προς το περιεχόμενο

php/mysql provlima me list/menu sto search.


maxFX

Προτεινόμενες αναρτήσεις

Δημοσ.

Exw 4 list/menu kai thelw na ta perasw stin results.php selida alla se auth tin selida den mou efanizei kanena apotelesma.

exw kanei kapio lathos? i den exw dilosi kati?

Parakalw koita3te ton kwdika parakatw kai peite mou...

 

 

search.htm

 

<form action="results.php" method="post" name="ski" id="ski">

<p><font size="2" face="Tahoma">Χώρα:

<select name="xwra" id="xwra">

<option value="_">_</option>

<option value="ΙΤΑΛΙΑ">ΙΤΑΛΙΑ</option>

<option value="ΕΛΒΕΤΙΑ">ΕΛΒΕΤΙΑ</option>

<option value="ΓΑΛΛΙΑ">ΓΑΛΛΙΑ</option>

<option value="ΑΥΣΤΡΙΑ">ΑΥΣΤΡΙΑ</option>

<option value="ΦΙΛΑΝΔΙΑ">ΦΙΛΑΝΔΙΑ</option>

<option value="ΑΜΕΡΙΚΗ">ΑΜΕΡΙΚΗ</option>

</select>

<br>

Χιονοδρομικό:

<select name="xionodro" id="xionodro">

<option value="_">_</option>

<option value="Val Di Fassa">Val Di Fassa</option>

<option value="Cortina">Cortina</option>

<option value="Courmayer">Courmayer</option>

<option value="Madonna di Campiglio">Madonna di Campiglio</option>

<option value="St. Moritz">St. Moritz</option>

<option value="Zermatt">Zermatt</option>

<option value="Crans - Montana">Crans - Montana</option>

<option value="Gstaad">Gstaad</option>

<option value="Verbier">Verbier</option>

<option value="Villars">Villars</option>

<option value="Davos">Davos</option>

<option value="Megene">Megene</option>

<option value="Courchevel - 3 Vallees">Courchevel - 3 Vallees</option>

<option value="Chamonix">Chamonix</option>

<option value="Avoriaz - Portes du Soleil">Avoriaz - Portes

du Soleil</option>

<option value="Val d' Isere - L' espace Killy">Val d' Isere

- L' espace Killy</option>

<option value="kitzbuhel">kitzbuhel</option>

<option value="kirchberg">kirchberg</option>

<option value="St. Johann">St. Johann</option>

<option value="Lech">Lech</option>

<option value="Zell am See / Kaprun">Zell am See / Kaprun</option>

<option value="Saalbach / Hinterglemm">Saalbach / Hinterglemm</option>

<option value="Badgastein">Badgastein</option>

<option value="Seefeld">Seefeld</option>

<option value="Περιοχή Innsbruck">Περιοχή Innsbruck</option>

<option value="Ischgl">Ischgl</option>

<option value="Ruka Ski Center">Ruka Ski Center</option>

<option value="Utah - Deer Valley (Salt Lake)">Utah - Deer Valley

(Salt Lake)</option>

<option value="Vermont - Killington">Vermont - Killington</option>

<option value="Colorado - Aspen">Colorado - Aspen</option>

</select>

<br>

Bugdet:

<input name="bugdet" type="text" id="bugdet" size="10">

<br>

Hotels:

<select name="hotels" id="hotels">

<option value="_">_</option>

<option value="LEONARDO HOTEL SUP - MOENA">LEONARDO HOTEL SUP

- MOENA</option>

</select>

<br>

Κατηγορία:

<select name="category" id="category">

<option value="_"></option>

<option value="*****">*****</option>

<option value="****">****</option>

<option value="***">***</option>

<option value="**">**</option>

<option value="*">*</option>

</select>

</font><font size="3" face="Tahoma"><br>

<br>

<input type="submit" name="Submit2" value="Αναζήτηση">

</font> </p>

</form>

 

 

results.php

 

<?

// Set Script Variables

$DB_Host="aaaaa";

$DB_Name="aaaa";

$DB_User="aaa";

$DB_Pass="aaaa";

$usertable="aaa";

$Per_Page= 1;

 

// Open MySQL Connection

$Connection=mysql_connect($DB_Host, $DB_User, $DB_Pass);

 

// Run The Query Without a Limit to get Total result

$SQL= "SELECT * FROM $usertable

WHERE xwra LIKE \"%$xwra%\"

OR xionodromiko LIKE \"%$xionodro%\"

OR bugdet LIKE \"%$snews%\"

OR hotel LIKE \"%$hotels%\"

OR katigoria LIKE \"%$category%\"";

 

$SQL_Query=mysql_db_query($DB_Name, $SQL);

$Total=mysql_num_rows($SQL_Query);

 

 

// Append a LIMIT clause to the SQL statement

if (!$Result_Set)

{

$Result_Set=0;

$SQL.=" LIMIT $Result_Set, $Per_Page";

}

else

{

$SQL.=" LIMIT $Result_Set, $Per_Page";

}

 

// Run The Query With a Limit to get result

 

$SQL_Query = mysql_db_query($DB_Name, $SQL);

$SQL_Rows = mysql_num_rows($SQL_Query);

 

 

//Total records found

 

echo "<table border=0 height=\"19\" cellspacing=\"0\" width=\"450\" bordercolor=\"#cccccc\">";

echo "<tr bordercolor=\"\" bgcolor=\"#FFFFFF\">";

echo "<td><font face=\"verdana\" color=\"#000000\" style=\"bold\" width=\"450\" size=\"2\">$Total Αποτελέσματα βρέθηκαν.</font></td>";

 

 

// Create Next / Prev Links and $Result_Set Value

if ($Total>0)

{

if ($Result_Set<=$Total && $Result_Set>0)

{

$Res1=$Result_Set-$Per_Page;

echo "<td ><font face=\"verdana\" color=\"#000000\" width=\"10\" size=\"2\"><A HREF=\"$PHP_SELF?Result_Set=$Res1\"><< Προηγούμενο</a></font></td>";

}

if ($Result_Set>=0 && $Result_Set<$Total)

{

$Res1=$Result_Set+$Per_Page;

if ($Res1<$Total)

{

echo "<td ><font face=\"verdana\" color=\"#000000\" width=\"10\" size=\"2\"><A HREF=\"$PHP_SELF?Result_Set=$Res1\">Επόμενο >></a></font></td>";

}

}

}

echo "</tr></table>";

$start_time = getmicrotime();

// Display Results using a for loop

if ( $SQL_Array = mysql_fetch_assoc( $SQL_Query ) ) {

//Buat table untuk papar result

// whatever that means...

do {

extract( $SQL_Array );

print "<br>";

print "<em><font size=2 face=Tahoma>($date)</em></font>";

print " <b>-</b> ";

print "<font size=2 face=Tahoma>$xwra</font>";

print "<br> ";

print "<font size=2 face=Tahoma>$xwrainfo</font>";

print "<br> ";

print "<font size=2 face=tahoma>$hotel</font>";

print "<font size=2 face=tahoma>$katigoria</font>";

print ("<br><font size=2 face=Tahoma><a href=\"skifull.php?skid=$skid\">Περισσότερα</a></font>");

print ("<p>");

}

while( $SQL_Array = mysql_fetch_assoc( $SQL_Query ) );

}

 

$end_time = getmicrotime();

{

print "<br><font face=\"tahoma\" size=\"1\"> Η αναζήτηση ολοκληρώθηκε σε ".(substr($end_time-$start_time,0,5))." δευτερόλεπτα.</font>";

}

 

function getmicrotime()

{

list($usec, $sec) = explode(" ",microtime());

return ((float)$usec + (float)$sec);

}

 

 

// Close Database Connection

mysql_close($Connection);

?>

 

Regards :)

Δημοσ.

:lol: :lol: Sini8imseno la8os, to exoume ksanapei, alla as to poume mia akoma fora....H teleutaia ekdosh ths php (pou mallon xrhsimopoieis) se anti8esh me tis palioteres, den epitrepei thn apeu8eias dimiourgia metablhtwn apo thn html forma sou. Etsi anti na exeis $xwra sto results.php tha prepei na baleis $_POST[xwra] . Omoiws me to $xionodro tha baleis $_POST[xionodro] ktlp ktlp

 

Se analogh periptwsh, an kaneis 'get' anti gia 'post' thn tmetablhth px $var tha thn pareis me GET[var]

 

Elpizw na boi8isa...

Δημοσ.

Tha prepei na kaneis ligo debugging...antikatestise to

>$SQL_Query=mysql_db_query($DB_Name, $SQL); 

me

>$SQL_Query=mysql_db_query($DB_Name, $SQL) or die("can not execute query"); 

gia na deis oti kaneis kanonika thn sindesi kai to query.

 

Bale kai merika echo ston kwdika sou gia na entopiseis pou simbainei to la8os.

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.

  • Δημιουργία νέου...