.php Page Refresh

Discussion in 'Programming/Scripts' started by dinesh.4126, Jul 31, 2009.

  1. dinesh.4126

    dinesh.4126 New Member

    Hi,
    I am beginer in PHP,HTML.We have deisgn a web in php for google map display+weather information with multi-language options.We want page to refresh ,if person enter weather data in msql server it will keep on refershing the webpage so that it will show updated information on page.Kindly help me what are additional things neede to added in code so that keep on refreshing the page after certain time duration.

    Below are code .php file :
    -----------------------------------------------------------------------------------------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Remote Weather Monitoring</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAZp4rKdeeazZBQ3EH922UUBTIorwmHn2vzvETmozy_EzYqHAPGRRS5FVIpoR9KihjOtSDuHwlbGw8LA"
    type="text/javascript"></script>
    <?php
    include_once("include_files_map.php");
    include_once(PATH_TO_MAIN_PHYSICAL_LANGUAGE.$language.'/'.FILENAME_INDEX);
    include_once(FILENAME_BODY);

    //print_r($_POST);
    if($_POST['language'])
    {
    switch($_POST['language'])
    {
    case 'oriya':
    define('TEXT_LANGUAGE','or_');
    break;
    case 'hindi':
    define('TEXT_LANGUAGE','hi_');
    break;
    case 'tamil':
    define('TEXT_LANGUAGE','ta_');
    break;
    case 'telugu':
    define('TEXT_LANGUAGE','te_');
    break;
    case 'bengali':
    define('TEXT_LANGUAGE','be_');
    break;
    case 'kanada':
    define('TEXT_LANGUAGE','ka_');
    break;
    default :
    define('TEXT_LANGUAGE','');
    break;
    }
    }


    $search_location_name=$_POST['TR_name'];
    $display_size=$_POST['size_of_display'];
    $map_type=$_POST['type_of_map'];

    //getting from data base
    $data=getAnyTableWhereData(LOCATION_TABLE,"name='".$search_location_name."'","*");


    $location_name=$data['name'];
    $latitude=$data['lat'];
    $langitude=$data['lng'];
    $weather=$data['weather'];
    $temp=$data['weatherinfo_temp'];
    $humidity=$data['weatherinfo_humidity'];
    $distance_from=$data['distance_from'];
    $distance_to=$data['distance_to'];
    $depth_from=$data['depth_from'];
    $depth_to=$data['depth_to'];
    // $fish_info=$data['fish_info'];
    $warning=get_name_from_table(WARNING_TABLE,TEXT_LANGUAGE.'warning','id',$data['weatherinfo_warning']);
    //echo aaa;
    //die();
    $wind_direction_from=$data['wind_direction_from'];
    -
    -
    -
    -
    -----------------------------------------------------------------------------------------------------
     
  2. Mark_NL

    Mark_NL New Member

    Put this in your head (just above the <title> tag):

    Code:
    <meta http-equiv="refresh" content="SECONDS; ,URL=http://URL_TO_YOUR_WEBSITE">

    SECONDS = Number of seconds to wait for a refresh (f.e.: 60)
    URL_TO_YOUR_WEBSITE = The URL to your webpage (f.e.: htp://www.domain.tld/weather.php)
     
  3. dinesh.4126

    dinesh.4126 New Member

    Below are the changes as suggested above in forum
    ----------------------------------------------------------------------------------------------------------
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta http-equiv="refresh" content="10"; ,URL="http://localhost/google/map_display.php">
    ---------------------------------------------------------------------------------------
    Page is refreshing.kindly see in attachment refreshing page.Kindly let know the solution of this or guide where is problem.
    *screenshot1 attachment is page real page when not refresh.
    *screen shot attachment is page after adding refresh header in php.
     

    Attached Files:

    Last edited: Jul 31, 2009
  4. falko

    falko Super Moderator ISPConfig Developer

    I guess there's a problem with an SQL query - the column TEXT_LANGUAGEwarning does not exist in the database table that you're querying.
     
  5. dinesh.4126

    dinesh.4126 New Member

    Below are the MYSQL table.In id filed table is with default null value so is their deafult value is needed??.
    +----------------------+---------------+------+-----+------------+----------------+
    | Field | Type | Null | Key | Default | Extra |
    +----------------------+---------------+------+-----+------------+----------------+
    | id | int(10) | NO | PRI | NULL | auto_increment |
    | name | varchar(40) | NO | | | |
    | lat | decimal(10,4) | NO | | 0.0000 | |
    | lng | decimal(10,4) | NO | | 0.0000 | |
    | weather | varchar(20) | NO | | | |
    | weatherinfo_temp | decimal(3,2) | NO | | 0.00 | |
    | weatherinfo_humidity | decimal(3,1) | NO | | 0.0 | |
    | weatherinfo_warning | text | NO | | NULL | |
    | wind_direction_from | smallint(5) | NO | | 0 | |
    | wind_direction_to | smallint(5) | NO | | 0 | |
    | windinfo_speed | decimal(6,1) | NO | | 0.0 | |
    | wave_height | decimal(10,4) | NO | | 0.0000 | |
    | inserted | date | NO | | 0000-00-00 | |
    | updated | date | NO | | 0000-00-00 | |
    | distance_from | decimal(6,1) | YES | | NULL | |
    | distance_to | decimal(6,1) | YES | | NULL | |
    | depth_from | decimal(6,1) | YES | | NULL | |
    | depth_to | decimal(6,1) | YES | | NULL | |
    +----------------------+---------------+------+-----+------------+----------------+
    Thng is that without using refresh it show google map+weather information but when <meta http-equiv="refresh" content="SECONDS; ,URL=http://URL_TO_YOUR_WEBSITE"> is inserted it shows on page.
    ----------------------------------------------------------------------------------------------------
    1054 - Unknown column 'TEXT_LANGUAGEwarning' in 'field list'
    select TEXT_LANGUAGEwarning from warning where id in ('')
    -----------------------------------------------------------------------------------------------------
    It might be because of in MYSQL data base id field deafult null is present in table??
     
    Last edited: Aug 3, 2009
  6. Mosquito

    Mosquito New Member

    My guess it has something to do with this line
    Code:
    $warning=get_name_from_table(WARNING_TABLE,TEXT_LA NGUAGE.'warning','id',$data['weatherinfo_warning']);
    
    What is the code for the function get_name_from_table()?
     
  7. dinesh.4126

    dinesh.4126 New Member

    Hi,
    Below is code for function get_name_from_table
    ------------------------------------------------------------------------------------------------------------------
    function get_name_from_table($table_name,$select_name,$field_name_id,$field_name_ids)
    {
    $name="";
    if($field_name_ids=='')
    $query="select $select_name from $table_name where $field_name_id in ('')";
    else
    $query="select $select_name from $table_name where $field_name_id in ($field_name_ids)";
    $result=tep_db_query($query);
    while($row=tep_db_fetch_array($result))
    {
    $name.=$row[$select_name].", ";
    }
    if(substr($name,-2,2)==", ")
    {
    $name=substr($name,0,-2);
    }
    tep_db_free_result($result);
    return $name;
    }
    ----------------------------------------------------------------------------------------------------------------------
    Has Anybody got any idea How to tackle this problem???
     
  8. dinesh.4126

    dinesh.4126 New Member

    In my Table Location :
    +----------------------+---------------+------+-----+------------+----------------+
    | Field | Type | Null | Key | Default | Extra |
    +----------------------+---------------+------+-----+------------+----------------+
    |
    | weatherinfo_warning | text | NO | | NULL | |

    +----------------------+---------------+------+-----+------------+----------------+
    If I want to change default attributes as shown below,then can somebody help what should be command to change default attributes.I search a lot in google but failed to do that.

    +----------------------+---------------+------+-----+------------+----------------+
    | Field | Type | Null | Key | Default | Extra |
    +----------------------+---------------+------+-----+------------+----------------+
    |
    | weatherinfo_warning | text | NO | | | |

    +----------------------+---------------+------+-----+------------+----------------+
     
  9. Craig

    Craig New Member

    Try removing the comma, i.e.
    Code:
    <meta http-equiv="refresh" content="10"; ,URL="http://localhost/google/map_display.php">
    becomes
    Code:
    <meta http-equiv="refresh" content="10"; URL="http://localhost/google/map_display.php">
     

Share This Page