Antiz Posted March 7, 2004 Report Share Posted March 7, 2004 Meeginu uztaisiit mazu banoshanas sisteemu, saaku ar ko vienkaarshaaku, bet nekaa. Shis te buutu man skripts: <?php mysql_connect("localhost","root",""); mysql_select_db("test"); $query = ("select * from bani where ip = ".$_SERVER['REMOTE_ADDR'].""); $result = mysql_query("select id from bani where ip = ".$SERVER['REMOTE_ADDR'].""); if(mysql_num_rows($result)>0){ echo "tev ir bans"; exit; } else{ echo " tev nav bans"; exit; } ?> Bet diez ko negrib straadaat, met aaraa: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ........... on line 6 Link to comment Share on other sites More sharing options...
hu_ha Posted March 7, 2004 Report Share Posted March 7, 2004 nu bet tev tak ir rakstiits, ka nav pareizs vaicaajums. kaads no vaicaajuma argumentiem nav korekts. paarbaudi vai tev ir tabula "bani" (un nevis bans or smth) paskaties vai ir laucinjh "ip" un "id" un tad ieraksti mysql control center vai veel kaut kur un paskaties vai vaicaajums tieshaam straadaa. tad veel shiis rindinjas jeega ir nekaada, jo sheit kodaa tas netiek izmantots: $query = ("select * from bani where ip = ".$_SERVER['REMOTE_ADDR'].""); visbeidzot shajaa rindinjaa: $result = mysql_query("select id from bani where ip = ".$SERVER['REMOTE_ADDR'].""); nomaini $SERVER['REMOTE_ADDR'] uz $_SERVER['REMOTE_ADDR'] netaceros kaa tur bij ar taam peedinjaam, proti paprovee kaut ko shitaadu: $result = mysql_query("select id from bani where ip =$_SERVER['REMOTE_ADDR']"); vai $result = mysql_query("select id from bani where ip =$_SERVER[REMOTE_ADDR]"); utt. Link to comment Share on other sites More sharing options...
Klez Posted March 7, 2004 Report Share Posted March 7, 2004 peedinjas neder. vajag apaostrofus. $result = mysql_query("select id from bani where ip = ".$SERVER['REMOTE_ADDR'].""); viaglaak buus taa: $ips = $_SERVER['REMOTE_ADDR']; $result = mysql_query("select id from bani where ip ='$ips'"); tam jaastraadaa Link to comment Share on other sites More sharing options...
Aleksejs Posted March 7, 2004 Report Share Posted March 7, 2004 Un ja nu gadījumā, nejauši šī rindiņa: mysql_connect("localhost","root",""); atbilst patiesībai attiecībā uz lietotāja root paroli - drošības pēc nomaini to ;) Link to comment Share on other sites More sharing options...
Recommended Posts