Jump to content

karthikeyan_coder

Members
  • Posts

    201
  • Joined

  • Last visited

    Never

Posts posted by karthikeyan_coder

  1. Hello,
        i am using flat file database...
    the data format is
    google.com || Google
    msn.com || MSN
    file name: data.txt

    i need to delete a row if the id is first column...
    let us say.. i need to delte the second row.. by clicking some link like.. deletelink.php?url=msn.com
    $url = $_GET['url'];

    now i need to delte the row which starts from $url from my text file... how is it possible? any help..  ???
  2. Hello,
            i want to get some random rows from my table.. here is the query

    [code]$ sql = "SELECT * FROM `banner` WHERE `AID`='1' AND `ACTIVE`='Y' ORDER BY rand() LIMIT 0,2";[/code]
    it is for getting two rows... is this will give me different two rows always?? coz im expecting some problems occationally, it gives less no of rows... it may be a problem with rest of my code.. but what do you think about rand() in the mysql query?

    Thank you.
  3. i need current Hour and Minute in the format 00 to 23 and 00 to 59.. i searched in
    http://in2.php.net/manual/en/function.date.php

    [quote]H 24-hour format of an hour with leading zeros 00 through 23[/quote]
    [quote]i Minutes with leading zeros 00 to 59[/quote]

    i tried this
    $k = date("Hi");
    echo("$k");
    output is...
    190753

    after each refresh it is just incrementing.. :(

    I need current Hour and Minute in 00 to 23 hour format and 00 to 59 minutes format... any other way to get???

    Thank you.
  4. here is the two functions for showing time in the format "3:57 pm"

    [code]function convert_timestamp($timestamp, $timezoneOffset=0) {
    $replacements = array(  '-' => '',
    ' ' => '',
    ':' => '');
    $timestamp = strtr($timestamp, $replacements);

    return $timestamp?mktime(
    substr($timestamp,8,2),
    substr($timestamp,10,2) - $timezoneOffset + $GLOBALS['fc_config']['timeOffset'],
    substr($timestamp,12,2),
    substr($timestamp,4,2),
    substr($timestamp,6,2),
    substr($timestamp,0,4)
    ):0;
    }

    function format_Timestamp($timestamp, $tzoffset) {
    return gmdate($GLOBALS['fc_config']['timeStampFormat'], convert_timestamp($timestamp, $tzoffset));
    }[/code]

    i need these functions to show US time... how can we change these functions to show US time?

    Thank you.
  5. hi here is the code which is showing some images..
    [code]
    <a href="url.php?id=<?php echo($id); ?>" target="_BLANK"><img src="<?php echo($domain); ?>" alt="<?php echo($name); ?>"></a>[/code]

    The images are showing with a blue border line... actually i dont want that blue border... Any one can help?
  6. banner.php
    is a file which outputs a banner image...
    if we call banner.php?59 then it will show 59th banner...

    i want to show banners in index.php

    i have this variable $banner_file = "banner.php?59";

    if i include($banner.php?59); then it is giving an error...

    i tried $banner_file = "'"."banner.php?id=".$arr."'";
    echo("$banner_file");

    output is.. 'banner.php?id=12'

    still im getting faild to ourput stream...error... please help me
  7. ahh Thank you Barand , printf and amalosoul ... i did the following code while waiting for all of your replies.. please check this... :)

    [code]<?php
    session_start();
    mysql_connect("localhost","root","");
    mysql_select_db("djnaf");
    if(!isset($_SESSION['total']))
    {
    $num = mysql_num_rows(mysql_query("SELECT * FROM `banners`"));
    $_SESSION['total'] = $num;
    //echo("rows $num");
    }
    $num = mysql_num_rows(mysql_query("SELECT * FROM `banners`"));
    //echo("rows $num");
    $current = $_SESSION['total'];
    $query = "SELECT * from `banners` LIMIT 0,$current";
    //echo($query);
    $pass = mysql_query($query) or die(mysql_error());
    $numb = mysql_num_rows($pass);
    for($i = 1;$i <=$numb; $i++)
    {
    $fetch = mysql_fetch_array($pass);
    $id = stripslashes($fetch['id']);
    $banners[$i] = $id;
    //Add values in array.
    }
    print_r($banners);
    ksort($banners);
    $end = count($banners);
    $arr = array_pop($banners);
    echo("Show banner $arr");
    if($current != 1)
    {
    $limit = (int)$current - 1;
    $_SESSION['total'] = $limit;
    }
    else
    {
    session_destroy();
    unset($_SESSION['total']);
    }
    ?>[/code]


    SQL
    [quote]CREATE TABLE `banners` (
      `id` int(11) NOT NULL,
      `name` text NOT NULL
    ) TYPE=InnoDB;

    --
    -- Dumping data for table `banners`
    --

    INSERT INTO `banners` (`id`, `name`) VALUES (1, 'b1');
    INSERT INTO `banners` (`id`, `name`) VALUES (2, 'b2');
    INSERT INTO `banners` (`id`, `name`) VALUES (3, 'b3');
    INSERT INTO `banners` (`id`, `name`) VALUES (4, 'b4');
    INSERT INTO `banners` (`id`, `name`) VALUES (5, 'b5');[/quote]


    Plese test this script and tell me how it is :) im testing yours...
  8. no i mentioned 9... it is just an example... see if we use this techq in banner showcase script then the number of impressions should be balancers... let..
    $a[1] = 1;
    $a[2] = 2;
    $a[3] = 3;
    $a[4] = 4;

    let us say each value of an array is pointing some other information like... banner id numbers which is placed in mysql table...

    if the page refreshes then our script should take one value from array...
    1st impression <One array element>
    2nd impression <Another array element>
    3rd impression <... another....>

    if the page got refreshed 20 or 200 times (it should be n number of times) at end of the total impressions... we are going to see the individual impressions of each array elements. it should be balanced like...
    $a[1] = [10 impressions]
    $a[2] = [10 impressions]
    $a[3] = [12 impressions]
    $a[4] = [11 impressions]

    impressions should be like above....

    got what im trying to say?
×
×
  • Create New...

Important Information

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.