Jump to content
php.lv forumi

Recommended Posts

Posted

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."'   ");

?>

Posted

$query = mysql_query("SELECT user_email, id, username, redzets FROM users WHERE redzets > '".$time-laiks."' ");

 

ievietoju username, jo nezinu tavu DB struktūru.

Posted (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 by eT`
Posted

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"?

Posted

Un kur mysql_error() ?

$query = mysql_query("SELECT user_email, id, redzets FROM users WHERE redzets > '".$time-laiks."'   ") or die(mysql_error());

Posted (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 by Kverkagambo
Posted (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 by Uldis
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...