C)zy Posted September 26, 2011 Report Posted September 26, 2011 Buna ziua am si eu o problema , am incercat sa realizez un site pe baza scriptului CS-DC.ro si merge destul de bine , problema este ca nu merge optiunea "cautare server" cand dau sa cauta un server dupa nume / mod sau orice altceva ...si dau trimite ...pur si simplu pagina isi da refresh ( desii sunt 7 servare in baza de date ) si apare formularul necompletat . Scriptul pe care ruelaza optiunea de cautare este : <?PHP include("include/rating_functions.php"); ?> <h2>Cauta Server in baza de date</h2> <form name="search" method="post" action="<?=$PHP_SELF?>"> Cauta : <input type="text" name="find" /> dupa <Select NAME="field"> <Option VALUE="ip">Adresa</option> <Option VALUE="modul">Mod</option> <Option VALUE="cod">Anticheat</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" class="box" value="Search" /> </form> <? //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Rezultatele cautarii</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM server WHERE upper($field) LIKE'%$find%'"); ?> <center><table border=0 class=margins cellspacing=1 width=99%> <tr><td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Status ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Live ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Adress ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Port ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Slots ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Anticheat ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ ISP ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Mod ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Country ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Rate ]</b></td> </tr> <?PHP //And we display the results while($result = mysql_fetch_array( $data )) { ?> <tr><td class=margins><center> <?php if ($fp=@fsockopen(htmlentities($ip, ENT_QUOTES),$port,$ERROR_NO,$ERROR_STR,(float)0.5)) { fclose($fp); echo '<img src="imagini/up.png" alt="Online"/>'; } else { echo '<img src="imagini/down.png" alt="Offline"/>'; } ?> </center></td> <td class=margins><center><a target='_blank' title='http://servers.cs-dc.ro/info.php?server=<?=$result['ip']?>:<?=$result['port']?>.html' onClick=window.open('stats/stats.php?ip=<?=$result['ip']?>&port=<?=$result['port']?>','mywindow','width=520,height=680')>Verifica</a></center></td> <td class=margins><center> <?=$result['ip']?> </center></td> <td class=margins><center> <?=$result['port']?> </center></td> <td class=margins><center> <?=$result['player']?> </center></td> <td class=margins><center> <?=$result['cod']?> </center></td> <td class=margins><center> <?=$result['net']?> </center></td> <td class=margins><center> <?=$result['modul']?> </center></td> <td class=margins><center> <?=$result['tara']?> </center></td> <td class=margins><center> Unavailable </center></td> </tr> <?PHP } print "</table></center>"; //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Cuvantul introdus nu se potriveste cu nimic din baza de date.<br><br>"; } } ?> Cand dau trimite , nu imi apare nici macar "Rezultatele cautarii" ci doar formularul . Din cate vad eu in script in codu : echo "<h2>Rezultatele cautarii</h2><p>"; ar trebui sa imi arate imediat dupa ce dau cauta / trimite . Asta ma duce cu gandul ca este de la formularul de contact , dar care este problema , ma puteti ajuta ? multumesc anticipat
rraulinio Posted September 30, 2011 Report Posted September 30, 2011 Cine e $find? "Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein "I'm gonna make him an offer he can't refuse." - Don Corleone Vito
C)zy Posted September 30, 2011 Author Report Posted September 30, 2011 Cauta : <input type="text" name="find" /> dupa if ($find == "") $Find reprezinta cuvantul cheie pe care se realizeaza cautarea
rraulinio Posted September 30, 2011 Report Posted September 30, 2011 L-ai declarat undeva si nu vad eu ($_POST['find'])? Ia verifica scriptul si dupa posteaza aici, te rog. "Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein "I'm gonna make him an offer he can't refuse." - Don Corleone Vito
C)zy Posted October 1, 2011 Author Report Posted October 1, 2011 $find = $_POST['find']; Am adaugat linia...acum e aceiasi problema ..isi da refresh si atat...totusi cred ca e problema la formural...si linia "if ($searching =="yes") "... cred ca ar trebui alta optiune de trimitere a acestuia edit : bun am observat ca nu am declarat "$searching = $_POST['searching'];" ...si acum nu isi da refresh ...apare doar Rezultatele cautarii [ Status ] [ Live ] [ Adress ] [ Port ] [ Slots ] [ Anticheat ] [ ISP ] [ Mod ] [ Country ] [ Rate ] Cuvantul introdus nu se potriveste cu nimic din baza de date. Orice as scrie aia apare .. daca las spatiu gol zice "You forgot to enter a search term" cum ar trebui Deci problema e ca nu le afiseaza..
rraulinio Posted October 1, 2011 Report Posted October 1, 2011 $data = mysql_query("SELECT * FROM server WHERE CELULA = '".$find."'"); Inlocuieste celula cu ce ai tu! "Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein "I'm gonna make him an offer he can't refuse." - Don Corleone Vito
C)zy Posted October 1, 2011 Author Report Posted October 1, 2011 Super , acu imi da internal server error ....
rraulinio Posted October 1, 2011 Report Posted October 1, 2011 Nu are legatura cu scriptul. Ai pus ceva in htacces sau chestii gen? Oricum, pune un ss sa vad. "Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein "I'm gonna make him an offer he can't refuse." - Don Corleone Vito
C)zy Posted October 1, 2011 Author Report Posted October 1, 2011 Server error The website encountered an error while retrieving http://www.csmaniack.com/cautare_svr.php. It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this webpage later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. nu am modificat nimica in htaccess..
C)zy Posted October 2, 2011 Author Report Posted October 2, 2011 Bun am facut modificari <?PHP include("include/rating_functions.php"); ?> <h2>Cauta Server in baza de date</h2> <form name="search" method="post" action="<?=$PHP_SELF?>"> Cauta : <input type="text" name="find" /> dupa <Select NAME="field"> <Option VALUE="ip">Adresa</option> <Option VALUE="modul">Mod</option> <Option VALUE="cod">Anticheat</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" class="box" value="Search" /> </form> <? $modul = $_POST['modul']; $cod = $_POST['cod']; $ip = $_POST['ip']; $searching = $_POST['searching']; $find = $_POST['find']; //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Rezultatele cautarii</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM server WHERE upper($field) LIKE'($find)'"); ?> <center><table border=0 class=margins cellspacing=1 width=99%> <tr><td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Status ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Live ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Adress ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Port ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Slots ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Anticheat ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ ISP ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Mod ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Country ]</b></td> <td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Rate ]</b></td> </tr> <?PHP //And we display the results while($result = mysql_fetch_array( $data )) { ?> <tr><td class=margins><center> <?php if ($fp=@fsockopen(htmlentities($ip, ENT_QUOTES),$port,$ERROR_NO,$ERROR_STR,(float)0.5)) { fclose($fp); echo '<img src="imagini/up.png" alt="Online"/>'; } else { echo '<img src="imagini/down.png" alt="Offline"/>'; } ?> </center></td> <td class=margins><center><a target='_blank' title='http://servers.cs-dc.ro/info.php?server=<?=$result['ip']?>:<?=$result['port']?>.html' onClick=window.open('stats/stats.php?ip=<?=$result['ip']?>&port=<?=$result['port']?>','mywindow','width= 520,height=680')>Verifica</a></center></td> <td class=margins><center> <?=$result['ip']?> </center></td> <td class=margins><center> <?=$result['port']?> </center></td> <td class=margins><center> <?=$result['player']?> </center></td> <td class=margins><center> <?=$result['cod']?> </center></td> <td class=margins><center> <?=$result['net']?> </center></td> <td class=margins><center> <?=$result['modul']?> </center></td> <td class=margins><center> <?=$result['tara']?> </center></td> <td class=margins><center> Unavailable </center></td> </tr> <?PHP } print "</table></center>"; //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Cuvantul introdus nu se potriveste cu nimic din baza de date.<br><br>"; } } ?> Totul e bine . problema e la $data = mysql_query("SELECT * FROM server WHERE upper($field) LIKE'($find)'"); cred Edit : mai mult ca sigur problema e la while($result = mysql_fetch_array( $data ))
rraulinio Posted October 3, 2011 Report Posted October 3, 2011 upper() nu prea exista, nu ai vrut sa folosesti defapt litere mari? Daca da, functia este strtouper() 1 "Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein "I'm gonna make him an offer he can't refuse." - Don Corleone Vito
+skyler_sdf Posted December 6, 2011 Report Posted December 6, 2011 mysql_fetch_array returns row as an associative array. an ex: $query="select .... from......"; $result=mysql_query($query); while($row=mysql_fetch_array($result); ..........
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now