Jump to content

chintansshah

Members
  • Posts

    244
  • Joined

  • Last visited

Posts posted by chintansshah

  1. Please use below function before after uploading image for resize it. After resizing successfully, save thumb image in Database also.

     

    function createthumb($name,$filename,$new_w,$new_h){
    $system=explode('.',$name);
    if (preg_match('/jpg|jpeg/',$system[1])){
    	$src_img=imagecreatefromjpeg($name);
    }
    if (preg_match('/png/',$system[1])){
    	$src_img=imagecreatefrompng($name);
    }
    

  2. then, you should use mysql_fetch_array() after excute your query.

    like

    $sql = mysql_query("SELECT * FROM country ORDER BY country_name ASC");
    
    while($data = mysql_fetch_array($sql))
    {
    echo 'Country Name - '.$data['country_name'].' Country id-'.$data['id'].'<br>';
    }
    echo "</form>";
    

     

  3. Find code

    //I hope you connect with Mysql
    $sql = mysql_query("SELECT * FROM country ORDER BY country_name ASC");
    echo "<form>";
    while($data = mysql_fetch_array($sql))
    {
    echo '<input name="country" type="checkbox" id="'.$data['country_name'].'" value="'.$data['country_name'].'">
          <label for="'.$data['country_name'].'">'.$data['country_name'].'</label>';
    }
    echo "</form>";
    

    Please let me know if you have any error.

  4. Use the same query which you have written. After getting result use club array function.

     

    function club_array($contents,$parent_id)

    {

    if(count($contents)>0)

    {

    $list = array();

    $children = array();

    foreach ($contents as $v )

    {

    $pt = $v[$parent_id];

    @$list = $children[$pt] ? $children[$pt] : array();

    array_push( $list, $v );

    $children[$pt] = $list;

    }

    $contents = $children;

     

    }

    return $contents;

    }

     

     

  5. when I php file from command prompt, I get error"Fatal error: DB Error: extension not found", find code here.

    require_once(BASEDIR."/cfg/config.inc");	
    
    set_include_path(BASEDIR."/lib:" .BASEDIR."/lib/class:" . get_include_path());
    
    require_once(BASEDIR."/lib/class/DB.php");
    require_once(BASEDIR."/lib/class/DB/Query.php");
    
    $_DB = DB::connect("mysql://" . $_CONFIG['DB']['username'] . (!empty($_CONFIG['DB']['password']) ? ":" . $_CONFIG['DB']['password'] : "")
    					. "@" . (!empty($_CONFIG['DB']['server']) ? $_CONFIG['DB']['server'] : "localhost") . "/" . $_CONFIG['DB']['database']
    					, array('debug' => 2, 'portability' => DB_PORTABILITY_ALL));
    
    
    if (PEAR::isError($_DB)) trigger_error($_DB->getMessage(), E_USER_ERROR);
    	DB_Query::setDefaultConnection($_DB);
    

     

     

  6. I don't understand your requirement 100% but I tried.

     

    You should create three different forms, one for Country, State and City.

    in Country form, Name field is there

    in State form, select country first and then add state name

    in City form, first selct country, respected state as per country selection and then enter city details.

     

     

×
×
  • 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.