Vecteevs Posted August 12, 2010 Report Share Posted August 12, 2010 Sveiki, izveidoju online skriptu, bet apjuku un nevaru parādīt online nikus kāds var palīdzēt? <? include ("dbc.php"); $time = time(); $laiks=400; mysql_query("UPDATE users SET redzets='$time' WHERE user_email='$_SESSION[lietotajs]'"); $query = mysql_query("SELECT user_email, id, redzets FROM users WHERE redzets > '".$time-laiks."' "); ?> Quote Link to comment Share on other sites More sharing options...
eT` Posted August 12, 2010 Report Share Posted August 12, 2010 $query = mysql_query("SELECT user_email, id, username, redzets FROM users WHERE redzets > '".$time-laiks."' "); ievietoju username, jo nezinu tavu DB struktūru. Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted August 12, 2010 Author Report Share Posted August 12, 2010 tu nesaprati, tas niks ir domāts kā user_email, bet man nerādas ka esmu online :( Quote Link to comment Share on other sites More sharing options...
eT` Posted August 12, 2010 Report Share Posted August 12, 2010 (edited) nu tad vajag kārtīgi paskaidrot :) <? include ("dbc.php"); $time = time(); $laiks=400; mysql_query("UPDATE users SET redzets='$time' WHERE user_email='$_SESSION[lietotajs]'"); $query = mysql_query("SELECT user_email, id, redzets FROM users WHERE redzets > '".$time-laiks."' "); while($arr = mysql_fetch_array($query)) { echo '<a href="manalapa.lv?lietotajs=' . $arr[1] . '">' . $arr[0] . '</a> <small>Pēdējo reizi redzēts' . $arr[2] . '</small>'; } ?> Edited August 12, 2010 by eT` Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted August 12, 2010 Author Report Share Posted August 12, 2010 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource hmm.. nevar ar to fetech array un jautājums, ko tu apzīmēji ar to "arr"? Quote Link to comment Share on other sites More sharing options...
eT` Posted August 12, 2010 Report Share Posted August 12, 2010 iemet savu kodu un db struktūru, jo vistacmāk kaut kas tavā galā nav pareizi. Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted August 12, 2010 Author Report Share Posted August 12, 2010 lauks tips nulle? redzets int(26) Nē es visu pārbaudīju visam itkā jābūt! Quote Link to comment Share on other sites More sharing options...
bubu Posted August 12, 2010 Report Share Posted August 12, 2010 Un kur mysql_error() ? $query = mysql_query("SELECT user_email, id, redzets FROM users WHERE redzets > '".$time-laiks."' ") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted August 12, 2010 Author Report Share Posted August 12, 2010 rāda ka 98 rindiņā, un 98 rindiņa ir šāda: while($arr=mysql_fetch_array($query)) Quote Link to comment Share on other sites More sharing options...
euphoric Posted August 12, 2010 Report Share Posted August 12, 2010 visticamāk kļūda 97 rindā... Quote Link to comment Share on other sites More sharing options...
Kverkagambo Posted August 12, 2010 Report Share Posted August 12, 2010 (edited) Vaicājumam jāizskatās tā: "SELECT user_email, id, redzets FROM users WHERE redzets > '".($time-$laiks)."' " Skaitliskai izteiksmei noteikti jābūt iekavās. Un varbūt laukam "users.redzets" nav īstais tips. Edited August 12, 2010 by Kverkagambo Quote Link to comment Share on other sites More sharing options...
Uldis Posted August 16, 2010 Report Share Posted August 16, 2010 (edited) Pamēģini šādi, visam būtu jāiet - > <? include ("dbc.php"); $time=time(); $laiks2 = time()-400; mysql_query("UPDATE users SET redzets=$time WHERE user_email='$_SESSION[lietotajs]'"); $query = mysql_query("SELECT user_email, id, redzets FROM users WHERE redzets > $laiks2"); while($arr = mysql_fetch_array($query)) { extract($arr); echo "<a href='http://www.xxxxx.lv/?lietotjs=".$arr['id']."'>".$arr['user_email']." pēdējo reizi redzēts".$arr['redzets']; } ?> Edited August 16, 2010 by Uldis Quote Link to comment Share on other sites More sharing options...
Uldis Posted August 16, 2010 Report Share Posted August 16, 2010 nezinu vienīgi par $_SESSION[lietotajs] vai to vajag likt pēdiņās. Ja neiet norādītais skripts, tad pamēģini tās pēdiņas noņemt vai vienkārši noradī manuāli user_email un apskaties kas notiek. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.