Jump to content

maca134

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.maca134.co.uk

Profile Information

  • Gender
    Male
  • Location
    Blackpool, UK

maca134's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey If i understand you correctly, this one it easy. I would save the filename in a var first: $filename = $value . '_' . str_replace('/', '', $data[$ccyValue][0]) . '.csv'; $filename = strtoupper($filename); $fp = fopen(DIR . $filename, 'w'); Thats should work
  2. Hey all Im trying to find a way to combine images but set the blend mode, like in Photoshop, selecting how layers are blended together. I have looked at all the docs for GD with no luck... Cheers in advanced Maca134
  3. you will have to draw the table if you use the PHP image functions. Finding a "HTML -> PDF" PHP is going to be much easier. try looking on www.phpclasses.org, its a great website for PHP classes
  4. Oh i use codeigniter all the time... Its easy to integrate it into a controller class Home extends Controller { public $item_count = 0; ...your other vars/controllers/etc... function _scan( $parent_cat_id = 0 ) { $result = mysql_query('SELECT * FROM `cats` WHERE `parent_id` = "' . $parent_cat_id . '"'); if ( mysql_num_rows($result) > 0 ) { $item_count = $item_count + mysql_num_rows($result); while ( $row = mysql_fetch_assoc($result) ) { $this->_scan( $row['id'] ); } } } function _get_item_count() { return $this->item_count; } } Or you could put the function into a Model, which would make sense, as they are for DB stuff
  5. You could embed the image data directly into the HTML page, take a look at this: http://danielcamargo.com/blog/embedding-image-in-html/ <div class="some_image" style="width:100px; height: 100px; background: url(data:image/gif;base64,<?php echo base64_encode($image_data_gif); ?>);"></div>
  6. Hey assuming you have an open database connection, the code below might be suitable: class recursive_scan { public $item_count = 0; function scan( $parent_cat_id = 0 ) { $result = mysql_query('SELECT * FROM `cats` WHERE `parent_id` = "' . $parent_cat_id . '"'); if ( mysql_num_rows($result) > 0 ) { $item_count = $item_count + mysql_num_rows($result); while ( $row = mysql_fetch_assoc($result) ) { $this->scan( $row['id'] ); } } } function get_item_count() { return $this->item_count; } } $rs = new recursive_scan; $rs->scan(); var_dump( $rs->get_item_count() ); I have tested it but it should work
  7. Cheers I was having a dumb moment lol
  8. Hey Im trying to set some vars in a class, here is code: class someClass { public $var1 = ''; public $var2 = ''; public function __construct($options) { if (isset($options) && is_array($options)) { foreach ($options as $key => $val) { $this->$$key = $val; } } } } $options = array('var1' => 1, 'var2' => 2); $class = new someClass($options); I know the above is wrong but can someone tell me how to access class vars, like you can access vars with a double dollar sign ($$vars) Thanks in advanced
  9. The best thing for you to do is re-write, putting the code on 'more than one line' It would of made the error easier to spot( line numbers are given on errors) The code would be a nightmare for you to maintain later on... But a quick look suggests theres missing quotes all over the show and some that havent be slashed out... So i suggest re-write (im sure you really dont want to tho)
  10. mysql_fetch_assoc is the function you require http://php.net/manual/en/function.mysql-fetch-assoc.php
  11. thats is because the function mysql_fetch_array() outputs an array. Try var_dump($output) and see what happens
  12. you need to make sure the fetch_array function is in the class. also i good idea to output the SQL instead on executing it to check it right. Might be an idea to remove the 'at' at the end of mysql_query(), if the SQL is correct then it wont produce an error.
  13. After the line 'public $ini;' Put 'private $query;' and the last line of the dbselect function change from $query = @mysql_query($q); to $this->query = @mysql_query($q); Now you can create another function like so: public function fetch_array() { return mysql_fetch_array($this->query); } This will return the results you after
  14. The last line of the function needs to be something like $this->query = @mysql_query($q); Then $row = mysql_fetch_array($this->query) will work if the line is inside a function in the same class as the function 'dbselect'
×
×
  • 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.