Jump to content

dgoosens

Members
  • Posts

    230
  • Joined

  • Last visited

Everything posted by dgoosens

  1. md5($1a); is the error... this is not OOPHP but procedural... thus, you should write it like this $1a = md5($1a);
  2. something like this... <?php $result = mysql_query("SELECT DISTINCT city FROM hotels ORDER BY city"); while($row = mysql_fetch_array($result)) { echo '<a href="city.php?id=' . $row['city'] . ' ">' . $row['city'] . '</a><br>'; } ?> but it would be much better to pass an ID than the city name you might run into trouble when there are spaces (New York) or accentuated chars (Málaga) to do so you would create a table in your DB CITIES - id - city HOTELS - id - hotel - city_id This would greatly improve your app.
  3. as a start... if these cities appear so often in your table, you might want to create a new table with them and link them to the hotels with an ID. otherwise, just change your query from $result = mysql_query("SELECT * FROM hotels ORDER BY city"); to $result = mysql_query("SELECT DISTINCT city FROM hotels ORDER BY city");
  4. and another thought... phpLiveDocx: http://www.phplivedocx.org/ I think this allows you to work directly within your Word files...
  5. hi, I guess you could save it as .txt and go through it line by line in PHP and save the data to a database... Filesystem Functions : http://uk.php.net/manual/en/ref.filesystem.php
  6. hi, looks to me that this is a php.ini configuration issue... I'm not quite sure which param is guilty here but you might want to start by looking at the "memory_limit" In both cases, xml_reader and fread, I think PHP tries to load the whole file in the memory... Also, do pay attention to the "max_execution_time" param...
  7. I confirm... you have to get the build you'll find there... simply unzip it an launch the bin (exe or sh) you need...
  8. nope... cuz if you configure you're application correctly, let's say with Zend_Config for instance, you would be able to set up one configuration for testing, and another for production... MysqlStuffBlaBla::getInstance() That's a singleton. I suppose you could do this: $adapter = 'Mysql'; $class = $adapter . 'StuffBlaBla'; $foo = $class::getInstance(); // or $foo = call_user_func(array($adapter . 'StuffBlaBla, 'getInstance')); But that's some ugly looking shit. I think you're talking about a factory. oups... you're right... Zend_Db is a factory... sorry about that...
  9. although I don't see the point of having two connections for the same DB... in that case you would not work with a singleton... obviously... nope... cuz if you configure you're application correctly, let's say with Zend_Config for instance, you would be able to set up one configuration for testing, and another for production... sorry, but you're wrong here... Idealy you would not hardcode this kind of stuff in your models. Instead you would use an abstraction layer to handle this... Ergo, one modification in your config file and you can jump from a MySQL to a PostgreSQL or to whatever DB you'd like.
  10. Well there are some places where a singleton comes in handy... doesn't it ? MrAdam talks about ZF... So Zend_Registry is quite useful I believe I find it very useful to make sure there is only one instance for the DB connection. I know you have to be careful with them though and don't use them everywhere...
  11. true... and obvious. but as far as I can see, it's the only way to call an external script... and... the mail clients do block the images but the user can then allow them to be displayed... So just make a nice signature, I'd say...
  12. Guys, Just figured I'd let you know that I just came across this news: http://blogs.sun.com/netbeansphp/entry/zend_framework_support_added I figure I am not the only freak that uses ZF and loves Netbeans... So...
  13. never had to do this... but I guess you can call a script within an <img ... /> tag... just make sure you return an image (1 px transparent for instance)... don't know, seems logic, for security reasons. and... in the src attribute image you could append a ?userId=WHATEVER but there have to be smarter ways to get this done...
  14. that 'll work... however, do have a look at CRON... it basically CRON is a services installed on your server that launches a PHP script every xx seconds. a quick google on CRON and PHP gave me quite some interesting results http://articles.sitepoint.com/article/introducing-cron# is one of them
  15. I guess you could simply use filemtime() to check the modified date but you'll have to use CRON or something to launch the request every XX seconds/minutes/hours ... http://php.net/manual/en/function.filemtime.php
  16. I guess you could start by trying to explain clearly what you are trying to achieve and what the actual problems are you encounter...
  17. and endless loop is a loop that never ends - lol for instance while(i<1) { echo "this is an endless loop"; $i = 0; } (this is a very very basic one)
  18. it's always interesting to have a look at scripts (Drupal for instance)... you'll learn a lot by just checking out how other people "think" and write their code... as to the framework... it really depends on your needs... and make sure that you do have a good knowledge of Object Oriented PHP as most Frameworks use that as to which framework... well just go through this forum and you'll notice that there a lot of pros and cons for each one of them... it really depends on what you want to do with them and how you want to work (some frameworks kind a let you do what you want while others force you to work their way)
  19. this is probably because one of the scripts you are including needs a lot of resources... maybe you have an error in your scripts or an endless loop... you might want to post your scripts here so that we can check this...
  20. well... finally got to the real business... (not at work anymore) Thus, I changed the $result of my Flickr class into an array and now the Zend_Cache is working... and serializing the data correctly. Here is my new class: class Flickr { protected $apikey; public function __construct() { $this->apikey = Zend_Registry::get('config')->flickr_api_key; } public function search($keywords, $amount = 6) { if(empty ($this->apikey)) { return null; } try { $flickr = new Zend_Service_Flickr($this->apikey); $results = $flickr->tagSearch($keywords, array( 'per_page' => $amount, 'tag_mode' => 'all', 'license' => 3 )); if($results->totalResults() > 0) { foreach ($results as $key => $value) { $resultsArray[$key] = $value; } return $resultsArray; } } catch (Zend_Service_Exception $e) { return null; } return null; } } I just had to change one line in my view... but it is working great now. Thanks a lot for your help 448191 ! dGo
  21. oh OK... lol - sorry... I am trying to figure this out while doing the job that I am payed for, which has nothing to do with PHP and is rather boring right now... I'll post my solution when I'll have one.
  22. I was only asking for advice... I thought this was the purpose of this forum... I did not ask you to write one single line of code did I... but thanks anyway...
  23. thanks a lot for your reply 448191 So, if I am getting this right, I should, within my Flickr class, convert the $result into an array... Would that work ? I guess I could iterate through the DOMNodeList and insert all the data into an array... or would there be some toArray() method that I could use for this ?
  24. there are two settings you need to change in your php.ini post_max_size and upload_max_filesize Did you edit both ?
  25. if you want to pass value through the URL, then it is a GET statement. even if you do this with JS....
×
×
  • 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.