How to get php date from MySQL database to javascript? -


i'm new web developer.i have following script ,where in enddate instead of 06:39:00 pm , want time mysql database, insert time 06:39:00. how can time mysql database script? body please me?

the script ,

<script>  var config = {             enddate: 'may 28 2016 06:39:00 pm',             timezone: 'asia/dhaka',             hours: $('#hours'),             minutes: $('#minutes'),             seconds: $('#seconds'),             newsubmessage: 'iftar remaining time up'         }; </script> 

my php code ,

<?php                         $date= date("y-m-d");                         $sql2=mysql_query("select *  `data` `date`='$date' ");                         $row2=mysql_fetch_array($sql2);                          ?>     .....     .....     <?php $time=$row2['iftar']; ?> 

i want input $time instead of 06:39:00 pm in enddate

you need collect data php pass variable javascript follows:

<?php     $date = // method of collecting date table ?> 

then @ bottom of page:

<script type="text/javascript">     var date = "<?= $date?>"; </script> 

you can access date variable in javascript using date


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -