Jump to content

Recommended Posts

  • Active+ Member

Hi guys,

 

I need to select time from this column.

 

 

I tried to do it with this code but I'm wasn't successful:

 

 

I got this error:

 

 

And I need to get the time with this variable:

 

 

If someone can help me I will be glad :)

 

Thanks for answers!

 

Regards,

 

ReFresh

I'll be always helpful!  😉

Link to comment
https://metin2.dev/topic/14637-php-problem-with-select-time-from-db/
Share on other sites

mysql too old

 

$conex = new mysqli(IP, USER, PWD);

$time = mysqli_fetch_array(mysqli_query($conex, "select create_time from account.account where id =whatever limit 1;"))["create_time"];

echo $time;

Search in google its the fastest way to get whatever you need, dont ask for help, try to do yourself or search the information.

  • Active+ Member
17 minutes ago, ѕeмa™ said:

mysql too old

 

$conex = new mysqli(IP, USER, PWD);

$time = mysqli_fetch_array(mysqli_query($conex, "select create_time from account.account where id =whatever limit 1;"))["create_time"];

echo $time;

Still I can't get result from DB.

PS: I'm using old CMS web 1.3 with old mysql.

I'll be always helpful!  😉

  • Active+ Member
4 minutes ago, Optimus said:

try SELECT * and give a print_r() to view if all it's ok....

I need to use old mysql parameters because my web is written in old mysql version.

I'll be always helpful!  😉

  • Active Member
2 hours ago, ReFresh said:

I need to use old mysql parameters because my web is written in old mysql version.

Where I said that you need new parametres!? I saidonly select all columns and print to see if work

spacer.png

  • Active+ Member
On 14. 1. 2017 at 11:58 PM, Optimus said:

Where I said that you need new parametres!? I saidonly select all columns and print to see if work

I have this now and it's work but not as I want:

$qcreatetime = mysql_query("SELECT create_time FROM ".SQL_HP_DB.".account WHERE id='".$_SESSION['user_id']."'");

while ($rowcreatetime = mysql_fetch_array($qcreatetime))

{$createtime = $rowcreatetime["create_time"];

echo $createtime;}

I'm still getting this error:

I'll be always helpful!  😉

On 16.1.2017 at 8:14 PM, ReFresh said:

I have this now and it's work but not as I want:

$qcreatetime = mysql_query("SELECT create_time FROM ".SQL_HP_DB.".account WHERE id='".$_SESSION['user_id']."'");

while ($rowcreatetime = mysql_fetch_array($qcreatetime))

{$createtime = $rowcreatetime["create_time"];

echo $createtime;}

I'm still getting this error:IMG_20170116_201330_811.JPG

You dont need while if you want to get only one record.

I dont understand your "error". 2016-08-30 18:55:21 is the right output, or?. Im wondering why the "Query was empty" message was generated because there is a response.

Try: 

$result = mysql_query("SELECT create_time FROM ".SQL_HP_DB.".account WHERE id='".$_SESSION['user_id']."' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_assoc($result);
echo date('F d, Y h:mA', strtotime($row["create_time"]));
// uncommand the following line if you want to debug the return value
// var_dump($row);

If "Query was empty" appears, look in your database if the "create_time" is really set for the given user_id.

Try :

$Query = mysql_query("SELECT create_time FROM ".SQL_HP_DB.".account WHERE id = '$_SESSION[user_id]'");
$Fetch = mysql_fetch_array($Query);
$create_time = $Fetch[create_time];

Vách ngăn phòng thờ
Vách ngăn phòng khách

58 minutes ago, eyormaz said:

Try :


$Query = mysql_query("SELECT create_time FROM ".SQL_HP_DB.".account WHERE id = '$_SESSION[user_id]'");
$Fetch = mysql_fetch_array($Query);
$create_time = $Fetch[create_time];

 

What is the decisive technical difference to my example? And why mysql_fetch_array? You don't need numeric and string keys here - you are using the column name, so its recommanded to use MYSQL_ASSOC.

ps: lower_case ftw ;)

  • Active+ Member

Thanks for help guys!! @ѕeмa™ @Optimus @Ayaka @eyormaz

PS: The problem was in another query. So now everything working as I wanted.

Have a nice day! :)

Regards,

ReFresh

  • Love 1

I'll be always helpful!  😉

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.