Jump to content

razorsese

Members
  • Posts

    66
  • Joined

  • Last visited

Posts posted by razorsese

  1. How I can replace the white line whit something else

    Example:

     

     

    simple sentence

    simple sentence

    simple sentence

     

    simple sentence

    simple sentence

    simple sentence

     

    to something like this

     

    $replaced

    simple sentence

    simple sentence

    simple sentence

    $replaced

     

    $replaced

    simple sentence

    simple sentence

    simple sentence

    $replaced

  2. I have the following code:

     

     

    My question is how i can return both the y and the z in magic function.( works with y alone)

     

    class X{
      private y;
      private z;
    
    
       public function __construct($y,$z) {
        $this->y = $y;
        $this->z = $z;
    
       }
      public function magic()
      {
        return $this->{ $this->y }(); //need to return both  Y & Z
      }
    }
    

  3. So i got the following url format

     

    localhost:8080/test

     

    now i have 1 link named LI if i click on it it becomes:

     

    http://localhost:8080/TST/il

     

    and in it i have a list of links if i click on one of them it becomes:

     

    http://localhost:8080/TST/item/view/19

     

    but now if I want to go back to that list if i click on LI it dosen't go back to http://localhost:8080/TST/il but instead it go to

     

    http://localhost:8080/TST/item/view/il

     

     

    the html code for the link is the following <a href="il">LI</a>

     

    and my .htaccess is the following :

     

    RewriteRule ^([a-zA-Z]*)/?([a-zA-Z]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&action=$2&id=$3 [NC]

  4. Hello to everyone!!

    I just messed around with javascript and I build this :

    Just search for a video and click it and then it will go into playlist.Playlist stay saved even if you quit browser!!

    http://crispo.tk

     

     

    Any critics will be appreciate!!

     

    P.S : I know it dosen't work with IE( sucks) and is heavly depedent on javascript!

  5. How I can achieve a full screen width div?

    Currently i'm using this code but when i scroll whit mouse wheel button on the right of the screen the div is not hidden;

     

    body{
    overflow-x:hidden;
    
    }
    div
    {
    margin: 0px -2000px;
    padding: 0px 2000px;
    }
    

  6. I have the following code which works perfectly

     

    "<a  href=".$t[$key]->title." />";

     

    but if i  change it to

     

    "<a  href="$t[$key]->title" />";

    it's appearing Catchable fatal error: Object of class product could not be converted to string in

     

    My question is can someone explain why that error pop-up?!

     

     

  7. I'm having a problem whit the pdo - sql statement:

    It dosen't return anything

    but when i try $sql = " SELECT en FROM word WHERE MATCH (sp) AGAINST (:word IN BOOLEAN MODE ) "; without the pdo it's working perfectly

    
    $sql = " SELECT en FROM word WHERE MATCH (:sp) AGAINST (:word IN BOOLEAN MODE ) ";
    	$st = $con->prepare($sql);
    	$st->bindValue(":word",$word,PDO::PARAM_STR);
    
    	  $st->bindValue(':sp','sp',PDO::PARAM_STR);
    
    
        
    	$st->execute();
    

  8. I'm having trouble of getting the code right

    When i try to dump the $x value it's appearing null;

     

    class Dictionary{
    
    var $id=null;
    var $en=null;
    var $sp=null;
    var $type=null;
    
    public function __construct($data=array())
    {
       if( isset($data['id']) ) $this->id= (int)$data['id'];	
       if( isset($data['en']) ) $this->en= $data['en'];
       if( isset($data['sp']) ) $this->sp= $data['sp'];
       if( isset($data['type']) ) $this->type= $data['type'];
      
    }
    public function store ( $params ) {
    
        // Store all the parameters
        $this->__construct( $params );
    }
    
    
    
    public function WordGet($word)//add the english and spanish word
    {
    
    	$con = new PDO(DBN,DB_USER,DB_PASS);
    	$sql = "SELECT *FROM word WHERE MATCH(en) AGAINST ('ctx')";
    	$st = $con->prepare($sql);
    	$st->bindValue(':word',$word,PDO::PARAM_STR);
    	$st->execute();
    	$r = $st->fetch();
    
    	$con = null;
    	return new Dictionary($r);
    
    }
    
    
    $test = new Dictionary;
    
    $x = $test->WordGet('ctx');
    
    
    var_dump($x);
    

  9. I need to return a specific key from the object converted to array but it seems that it dosent work

     

    $toarray = (array)$tmp;
    $name = array_keys($toarray,'name');
    print_r($toarray);
    

    print:Array ( [id] => 9 [name] => dfd [text] => fdsf [rating] => 0 [totalv] => 0 )

     

    and when i try to return the key

     

    print_r($name);

     

    Array ( [0] => rating [1] => totalv )

     

    But I only need the key whit the 'name' value

  10.  

    I got 30 files to convert to png each in a dir containing 5 files

    I get the maximum execution time when i run the following code:

    
    $dir = glob("images/*/*.png");
    
    foreach($dir as $file)
    {
    $filename  = $file;
    $files = getimagesize($filename);
    $img = imagecreatefrompng($filename);
    imagepng($img,$filename);
    }
    

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