vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   how to Pass the timestamp into the vbdate() function to return a readable date???? (https://vborg.vbsupport.ru/showthread.php?t=128802)

vietkieu_cz 10-11-2006 09:15 AM

how to Pass the timestamp into the vbdate() function to return a readable date????
 
I would like to Select time edited by xxx to show them on my custom page
i've tried


PHP Code:

$query  "SELECT dateline FROM post WHERE postid = 2";
$result mysql_query($query);
while(
$row mysql_fetch_array($resultMYSQL_ASSOC))
{
    echo  
{$row['dateline']}";


but it shows something like 1160411620 not Last edited by vietkieu_cz : Today at 5:16pm. Reason: example time

thanks

nico_swd 10-11-2006 09:46 AM

PHP Code:

while($row mysql_fetch_array($resultMYSQL_ASSOC))
{
    echo  
vbdate('dS M Y H:i:s'$row['dateline'], true)


EDIT:

The loop isn't necessary if you want to fetch one row only. You can do this instead.
PHP Code:

$query  "SELECT dateline FROM post WHERE postid = 2";
$result mysql_query($query);
$postinfo mysql_fetch_array($result);

echo  
vbdate('dS M Y H:i:s'$postinfo['dateline'], true


vietkieu_cz 10-11-2006 11:00 AM

This is my php file,

PHP Code:

<? include 'includes/config.php';

$conn2 = mysql_connect(
$config['MasterServer']['servername'],  $config['MasterServer']

['username'], $config['MasterServer']['password']);

//Chon CSDL de lam viec
mysql_select_db(
$config['Database']['dbname'], $conn2)
    or die("Cannot connect.");

$query  = "SELECT dateline FROM post WHERE postid = 2"; 
$result = mysql_query($query); 
$postinfo = mysql_fetch_array($result); 

echo  vbdate('dS M Y H:i:s', $postinfo['dateline'], true)  

mysql_close($conn2);
?>

it shows
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\AppServ\www\354\test.php on line 19

what did i do wrong?

nico_swd 10-11-2006 11:47 AM

My bad, I forgot a semicolon at the end of this line.

PHP Code:

echo  vbdate('dS M Y H:i:s'$postinfo['dateline'], true); 


vietkieu_cz 10-11-2006 12:21 PM

PHP Code:

<? include 'includes/config.php'; 

$conn2 = mysql_connect( 
$config['MasterServer']['servername'],  $config['MasterServer'] 

['username'], $config['MasterServer']['password']); 

//Chon CSDL de lam viec 
mysql_select_db( 
$config['Database']['dbname'], $conn2) 
    or die("Cannot connect."); 

$query  = "SELECT dateline FROM post WHERE postid = 2";  
$result = mysql_query($query);  
$postinfo = mysql_fetch_array($result);  

echo  vbdate('dS M Y H:i:s', $postinfo['dateline'], true);

mysql_close($conn2); 
?>

still not work


Fatal error: Call to undefined function: vbdate() in C:\AppServ\www\354\test.php on line 17

nico_swd 10-11-2006 12:27 PM

Include global.php.


All times are GMT. The time now is 11:02 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01716 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete