Last update

Requests, feedback, and general discussion about WoWRoster
DO NOT post topics about WoWRoster AddOns here!

Last update

Postby Le-Thor » Tue Jul 31, 2007 5:56 pm

On roster there are this "Last Update", how can i get this on another site?

I can find it in the database, but i cant get the value out.

Here is my code:
(i have filled the host, name, user and pass in my code there is online)

Code: Select all
<?php
$db_host   = "host";
$db_name   = "name";
$db_user   = "user";
$db_passwd = "pass";


$roster = mysql_connect($db_host, $db_user, $db_passwd);

mysql_select_db('$db_name', $roster);

$date = mysql_query('SELECT `update_time` FROM `roster_guild`');

echo $date

?>


The result is: Resource id #3

What goes wrong?
Last edited by Le-Thor on Wed Aug 01, 2007 3:51 am, edited 1 time in total.
User avatar
Le-Thor
WR.net Apprentice
WR.net Apprentice
 
Posts: 6
Joined: Mon Jul 23, 2007 8:30 pm
Location: Denmark

Last update

Postby zanix » Wed Aug 01, 2007 4:11 am

Your forgot mysql_fetch

mysql_query returns a resource id, not data

Code: Select all
<?php
$db_host   = "host";
$db_name   = "name";
$db_user   = "user";
$db_passwd = "pass";


$roster = mysql_connect($db_host, $db_user, $db_passwd);

mysql_select_db('$db_name', $roster);

$result = mysql_query('SELECT `update_time` FROM `roster_guild`');

$date = mysql_fetch_array($result);

echo $date[0]
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Last update

Postby Le-Thor » Wed Aug 01, 2007 2:27 pm

nice, thanks.

Another question, this is the timeformat i got.
2007-07-25 19:48:00

can i get the timeformat like this: 25-07-2007 19:48 or like this 25 jul 2007 - 19:48

can it be done?
Last edited by Le-Thor on Wed Aug 01, 2007 2:27 pm, edited 1 time in total.
User avatar
Le-Thor
WR.net Apprentice
WR.net Apprentice
 
Posts: 6
Joined: Mon Jul 23, 2007 8:30 pm
Location: Denmark

Last update

Postby zanix » Thu Aug 02, 2007 2:41 am

Yes, pass the result through date()
http://us3.php.net/date
Code: Select all
<?php
$db_host   = "host";
$db_name   = "name";
$db_user   = "user";
$db_passwd = "pass";


$roster = mysql_connect($db_host, $db_user, $db_passwd);

mysql_select_db('$db_name', $roster);

$result = mysql_query('SELECT `update_time` FROM `roster_guild`');

$date = mysql_fetch_array($result);

echo date('FORMAT',strtotime($date[0]));
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Last update

Postby Le-Thor » Thu Aug 02, 2007 3:56 pm

Thanks Zanix, its works fine.
User avatar
Le-Thor
WR.net Apprentice
WR.net Apprentice
 
Posts: 6
Joined: Mon Jul 23, 2007 8:30 pm
Location: Denmark


Return to General Support & Feedback

Who is online

Users browsing this forum: No registered users and 0 guests

cron