Jump to content

Simple Script, or so I thought


MrLarkins

Recommended Posts

well, It's been a while since I've written anything.  I was only ever a newblet in the first place at it.  But I gave it my best shot.  Can anyone help me out here?

 

I just need a simple list shown.

here's what I already have.

<?php
require "conf_global.php";

//--------------------------------
//Time to Connect
//--------------------------------
$conn = mysql_pconnect ($INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass']) or die(mysql_error());
mysql_select_db ($INFO['sql_database']) or die(mysql_error());

//--------------------------------
//Talking With the DB
//--------------------------------
$info = mysql_query ("SELECT * FROM ibf_members WHERE last_activity > time()-86400 ORDER BY members_display_name");  


//-------------------------
//The Info
//-------------------------
$array_one = mysql_fetch_array($info);
$array_two = $array_one["members_display_name"];
$array_three = $array_one["mgroup"];


//------------------------------
//Member Group Color
//------------------------------


  if ($array_three = 6) { //admin
    $color = "#FFE910";
  } 
  elseif ($array_three = 7) { // OSK-Member
    $color = "#78A7BF";
  } 
  
  else { //Member
  	$color = "#E5E8E9";
}  



//-----------------------------------
//List 'Em
//-----------------------------------

echo ('<font size=-2 color="'.$color.'">');
echo ($array_two);
echo ('</font>');

mysql_close($conn);
?>

Link to comment
Share on other sites

have fun ;)

 

<?php
require "conf_global.php";

//--------------------------------
//Time to Connect
//--------------------------------
$conn = mysql_pconnect ($INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass']) or die(mysql_error());
mysql_select_db ($INFO['sql_database']) or die(mysql_error());

//--------------------------------
//Talking With the DB
//--------------------------------
$info = mysql_query ("SELECT * FROM ibf_members WHERE last_activity > time()-86400 ORDER BY members_display_name");  


//-------------------------
//The Info
//-------------------------

while($array=mysql_fetch_array($info)){;
$array=$array["members_display_name"];
$array_two=$array["mgroup"];
}


//------------------------------
//Member Group Color
//------------------------------


  if ($array_two==6) { //admin
    $color = "#FFE910";
  } 
  elseif ($array_two==7) { // OSK-Member
    $color = "#78A7BF";
  } 
  
  else { //Member
     $color = "#E5E8E9";
}  



//-----------------------------------
//List 'Em
//-----------------------------------

echo '<font size=-2 color="'.$color.'">';
echo $array;
echo '</font>';

mysql_close($conn);
?>

Link to comment
Share on other sites

basically, i'm trying to grab everyone who has been active in the last 24 hours.

$info = mysql_query ("SELECT * FROM ibf_members WHERE last_activity < time()-86400 ORDER BY members_display_name");  

selectin all from table ibf_members where last activity is within 24 hours...i really don't think that msyql_query line is correct

Link to comment
Share on other sites

not good, here's what phpMyadmin kicks back

Error

SQL query: 

 

SELECT *

FROM ibf_members

WHERE last_activity > time( ) -86400

ORDER BY members_display_name

LIMIT 0 , 30

 

MySQL said: 

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')-86400 ORDER BY members_display_name

LIMIT 0, 30' at line 1

 

 

i changed the code a bit and i didnt get an error, but i got an empty list

//--------------------------------
//Talking With the DB
//--------------------------------
$time = (time()-86400);
$info = mysql_query ("SELECT * FROM ibf_members WHERE last_activity > $time ORDER BY members_display_name");  

Link to comment
Share on other sites

ah ha! i got it...the query won't accept time() but will accept a variable...AND i need to move the closing '}' from the while fucntion to the end of the whole script...now it works!  thanks ya'll

it always helps to bounce ideas off of someone else.

Link to comment
Share on other sites

I saw that too, but it wasn't a space...it just looks like a space. 

it makes the list, but doesn't change the colors...i'll work on that part tomorrow...thanks for the help!

 

working:

PAST 7 DAYS

http://www.oskgaming.com/forums/visitors7.php

 

PAST 30 DAYS

http://www.oskgaming.com/forums/visitors30.php

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.