Jump to content

knowj

Members
  • Posts

    49
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

knowj's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have setup a fulltext search for one of our projects and its working great apart for one thing. If you type in fire and the index's contain `fires` it is unable to find these results. I am using a simple match/against/Boolean on an ANY search. Is this a restriction of FULLTEXT or am I just being retarded. It's not really relevant but I might as well include my query: SELECT *, MATCH(article_title, article_body) AGAINST ('$any' IN BOOLEAN MODE) AS score FROM `articles` WHERE MATCH(article_title, article_body) AGAINST ('$any' IN BOOLEAN MODE) I looked into Query Expansion but the results it started returning were completely irrelevant. [/code]
  2. thanks for the offer but i will be fine from here on in. labeling my arrays from 0-6 in the test environment just put me into confusion. Now i have the logic sorted I can program away. Cheers for the help
  3. Apologies its giving me the new order of the p_id so in theory i should be able to go through assigning new ID's based on that. $matches[0] = Array ( [0] => 5 [1] => 54 [2] => 27 [3] => 15 [4] => 23 ) foreach ($match[0] as $name => $name) { $query = "update `names` set `order`='$name' where `id`='$value'"; $this->execute($query); } the only place i can see this being problematic now is if the ordering is done across multiple pages the current method would only work for a single page ordering system.
  4. I have been playing about with jquery and have got a drag and drop reordering script working (client side) I now need to somehow work this into the database environment. example table p_id, p_name, p_order 8 , john , 1 16 , fred , 2 2 , james , 3 5 , james , 4 11 , james , 5 10 , james , 6 if i was to move john to position 3 i would get an array that looks like $matches[0] = Array ( [0] => 2 [1] => 3 [2] => 1 [3] => 4 [4] => 5 [5] => 6 ) The logic is where I'm stuck how can i now convert the order into the new order? ??? Thanks in advance J
  5. thats great thanks. It's been a while since i touched regex i get rusty quickly.
  6. I need to retive a url in the following format frorm an xml file: http://farm4.static.flickr.com/3028/2808182892_e33d69ed02_m.jpg echo '<img src="'.$xml->entry[$i]->user->profile_image_url.'" alt="'.$xml->entry[$i]->title.'" title="'.$xml->entry[$i]->title.'"/> '; <content type="html"><p><a href="http://www.flickr.com/people/4353454@N4502/">user</a> has added a photo to the pool:</p> <p><a href="http://www.flickr.com/photos/999999@343/2808182892/" title="Sunset"><img src="http://farm4.static.flickr.com/3028/2808122892_e33d52ed02_m.jpg" width="240" height="180" alt="Sunset" /></a></p> </content> This would have to be done with a regular expression on the http:// and closing on the .jpg. I also cant work out which function willl be best to use ideally it would return the value rather than store it within an array. thanks in advance
  7. Solved using: <?php header("Content-Type: text/xml"); require_once '../includes/class_constants.php'; require_once '../includes/class_cache.php'; $cache = new cache(constants::CACHEDIR); //start output buffer ob_start(); //get cache data $cache->get('flickr.txt', 86400); //check the cache has loaded if (!$cache->load()) { /* start content */ passthru("curl http://api.flickr.com/services/feeds/groups_pool.gne?id=USER@FSDF&lang=en-us&format=rss_200"); /* end content */ //load header into $header car $cache->newcache(ob_get_contents()); //clean the output buffer ob_clean(); //create the cache $cache->save('flickr.txt'); } ob_end_clean(); echo $cache->export(); ?>
  8. I feel pretty stupid asking this but i need to retive xml data from an external source and include it into my cache script. An easier way of putting it would be i need to display: http://api.flickr.com/services/feeds/groups_discuss.gne?id=USERNO@DSD&lang=en-us&format=rss_200 as http://www.myurl.com/flickerfeed.php My minds just hitting a blank at the moment thanks in advance. <?php header("Content-Type: text/xml"); require_once '../includes/class_constants.php'; require_once '../includes/class_cache.php'; $cache = new cache(constants::CACHEDIR); //start output buffer ob_start(); //get cache data $cache->get('flickr.txt', 86400); //check the cache has loaded if (!$cache->load()) { /* start content */ //get file xml from here -> 'http://api.flickr.com/services/feeds/groups_discuss.gne?id=USERNO@DSD&lang=en-us&format=rss_200'; /* end content */ //load header into $header car $cache->newcache(ob_get_contents()); //clean the output buffer ob_clean(); //create the cache $cache->save('flickr.txt'); } ob_end_clean(); echo $cache->export(); ?>
  9. *bump* - anyone have any knowledge in this field?
  10. We use both on our servers. Currently I perfer to use the GD it seems to get the job done faster unless you fork out your processes within PHP. I haven't looked into how it effects the cpu but in terms of actual load times after an image upload/resize GD (on our servers) currently has the edge. The main reason we installed image magik was because GD1 was pretty dismal but since its been updated the results are alot better. They each have their own strengths and weaknesses.
  11. I second that unless you want to write an algorithm to compete with pagerank. You may be able to do something on a rank based system using fulltext http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html but it's going to require ALOT of knowledge and time. Stick to the keyword idea its simple and effective.
  12. Usually when someone hacks the server your on or manages to get your ftp password as your web hosting provider will usually tell you (usually a lie). just change your passwords and remove the offending code.
  13. Best thing to do is to loop the post data into a mysql_real_escape_string() to catch everything. Then i prefer to always escape Superglobals within strings (SQL string in this case) i find it makes the code easier to read within programs with code highlighting and prevents any common gotchyas <?php foreach ($_POST as $name => $value) { $_POST[$name] = mysql_real_escape_string($value); } $qinsert = "UPDATE `Character` SET `user` = '".$_POST['username']."', `password` = '".$_POST['password']."', `realname` = '".$_POST['realname']."', `maintoonsname` = '".$_POST['maintoonsname']."', `location` = '".$_POST['location']."', `timezone` = '".$_POST['timezone']."', `playtime` = '".$_POST['playtime']."', `blog` = `$blogging` WHERE `id`='$idd' LIMIT 1"; mysql_query($qinsert) or die(mysql_error()); ?>
  14. I sometimes cheat and use arrays it saves alot of work when your needing to handle alot of data in a similar way or throw it back to a form. If you retain the structure of a $_POST from a form within an object array you can validate the data and return it to the form with little/no effort where as if you process it into separate object variables you have to return the data into its original structure. Arrays save time but its not necessarily best practice. However if you are adding a product to a store system you are going to want to treat all the data for that product in a similar fashion they wouldn't need different permissions (private $name; public $size;) So what is the actual need other than for "best practice". I say best practice is the practice that makes me the least amount of work. public function add() { $this->values = $this->database->antisql($this->values); foreach($this->values as $name => $value) { //remove x and y (image coordinates which are not to be entered into the database) $array = array('x', 'y'); if (!in_array($name, $array)) { $start .= '`'.$name.'`, '; $end .= "'".$value."', "; } } $start = substr($start, 0, -2); $end = substr($end, 0, -2); if ($this->database->query("INSERT INTO `products` ($start) VALUES ($end)")) { return 1; } return 0; }
  15. Noooo iFrames (unless your using it for a similar method to google images) If you want to archive the effects of an iframe use a div with a fixed width/height and apply an overflow. when you have the wonders of php includes dont bastardise your site with iframes
×
×
  • 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.