Jump to content

andyhajime

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by andyhajime

  1. Used the print_r() and it returns: #Array ( [0] => 10336 [OCTET_LENGTH(imageraw)] => 10336 ) Database recorded: [bLOB - 10.1 KiB] So complete formula would be: $LENGTH = mysql_query("SELECT OCTET_LENGTH(blobdata) FROM thedatabase WHERE id = 'selected_id'"); $FOUND = mysql_fetch_array($LENGTH); $RESULTS = $FOUND['0'] / 1024; echo round($RESULTS, 1).'KiB'; // Results: 10.1KiB Thanks Pikachu2000 & PFMaBiSmAd! AWESOME! I'm so going to write down this snippet so people can use it. There's barely any tutorial online!
  2. I tried this, still not working. Sorry, my php knowledge is very limited in this. $LENGTH = mysql_query("SELECT OCTET_LENGTH(blobdata) FROM thedatabase WHERE id = 'selected_id'"); $FOUND = mysql_fetch_array($LENGTH); echo $FOUND;
  3. I've told the client and the webhoster about the problem they might facing, they gave me the green light, and they wanted this method... as long as there's black and white stating I'm not going to be responsible, fine by me. anyone know how to get blob size? please help dearly me.
  4. Try saving the image name as a timestamp. eg: 200110112312 / YYYYMMDDHHMM. Unless you can use CRONJOB, suggest maybe each time a person visited the captcha page, do the clean up as well.
  5. <?PHP $FIND = mysql_query("SELECT * FROM imagedata WHERE imagecode = '$DO' && imagemodel = '$WHAT'") or die(mysql_error()); $FOUND = mysql_fetch_array($FIND); header("Content-type: image/".$FOUND['imagemime']); echo $FOUND['imageraw']; ?> This is mine and it's working nicely. Try use the example.
  6. The images stored are less then 10kb. Hardly 'stress' mysql. The guy attending the sever said it's so far so good. That's why I need this to work. So I can control the store data. you know how to make it work?
  7. Hey there, need some help badly. I'm trying to get the size of the BLOB data in mysql. Did a search and there are like no tutorial on this. Only relevant info was from this page, at the far bottom, it just wrote this (below code). But the writer did not explain how to use it. SELECT OCTET_LENGTH(content) FROM BloBTest WHERE filename='myimage.png' I just give it a trial an error, wrote this, but did not work. $LENGTH = mysql_query("SELECT OCTET_LENGTH(blobdata) FROM thedatabase WHERE id = 'selected_id'"); echo $LENGTH; Please help....
  8. Hello all, I'm currently doing this Facebook connect module for my website. With the FBconnect, it creates a user profile on my mysql, which stores only the Facebook userid, the full name, and the thumbnail url of this user. Currently the code works well except for this 'image url checking'. this is my fb profile image url: http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs349.snc4/41540_772137439_5612219_q.jpg when I've added a 'XXX' at the back ( http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs349.snc4/41540_772137439_5612219_qXXX.jpg ). It returns a blank instead. On Facebook, some accounts are not genuine and they might the deleted sooner or later. So I'm trying to figure out a php script or functions which detect if the image is not the 'XXX' version. I've tried using getimagesize() or file_get_contents() but still won't work. any ideas?
  9. Can you paste out the codes instead?... thanks.
  10. If you mean you want to limit the number of characters on the content, you can use my function. Enjoy. Usage: <td valign='top'>".TEXTCUT($a[content],"80")."</td> Function: function TEXTCUT($text, $words) { //<!-- code by iDexigns--!> $text = strip_tags($text); $matches= preg_split("/\s+/", $text, $words + 1); $sz = count($matches); if ($sz > $words) { unset($matches[$sz-1]); return implode(' ',$matches)."..."; } return $text; }
  11. Guys, I've just find out the problem. Apparently one of the 'uename' in the database is EMPTY/Blank. When I've replace the 0 with nothing, then it works. It's no wonder it say "Empty delimiter" in strstr, the strsrt is getting an 'empty' value. lols $FIND = mysql_query("SELECT * FROM userdata WHERE uename != ''") ZachMEdwards: Thanks man... the 'do nothing' part is normally there for checking only like the sample below. I usually don't use the 'do nothing' method unless I encounter errors it the code. But thanks yeah for responding. Appreciate it. if(strstr($email, "@")) { echo 'found'; //...and do something } else { echo 'not found'; // do nothing }
  12. Thanks everyone for helping, especially to Foxsoup for writing it out. You're the man!
  13. Hi all, What the coding does is suppose to do is run a sql_query on the database, fetch the id of the names in the $TEXT (if exist) and replace it with the <a> tag linking to their profile... but I couldn't quit understand why I keep receiving an "strstr(): Empty delimiter". Please help. $TEXT = "There you see andy walks on the road to that azy house"; $FIND = mysql_query("SELECT * FROM userdata WHERE uename != '0'"); while($FOUND = mysql_fetch_array($FIND)) { $UENAME = $FOUND['uename']; // note: first result is 'andy' (id: 1) followed by 'misa' (id: 2) then 'azy' (id: 3) if(strstr($TEXT, $UENAME)) //<--- ERROR: Warning: strstr() [function.strstr]: Empty delimiter in /home/public_html/ajax.php on line 59 { $TAGNAME = ' <a href="profile.php?id='.$FOUND['id'].'">' . $UENAME . '</a> '; $TEXT = str_replace($UENAME, $TAGNAME, $TEXT); } else { // do nothing } } // result: There you see <a href="profile.php?id=1">andy</a> walks on the road to that <a href="profile.php?id=3">azy</a> house
  14. Hi everyone, I need some pointers on how I can do this... This is the content: Notice there's this "[[" & "]]" in the names... I want a write a function that replace whatever in between the [[]] into a url link to their profile. But I having difficulty getting these value out so I can do a SQLquery stuff - eg Azrael, HarryEx, ect. At first I figure looking at Preg_replace and Ereg_replace but I can't find a good proper tutorial to guide me with. Please help this poor soul and direct me to which php function I should use for such task.
  15. Thanks... used decimals. It works. Noted about the backup, which I normally did.
  16. Hey everyone... I'm really stuck. Need help. On mysql_query script (default mode) $FIND = mysql_query("SELECT * FROM listdata WHERE listing_status = '193'"); The above line result these numbers below. - 50.00 - 1200.20 - 46.86 - 843.20 - 10 - 510000 When I add ORDER BY number DESC, it results this which is totally wrong. I've notice it sorted out based on the first digit instead of as a whole number. - 843.20 - 510000 - 50.00 - 46.86 - 1200.20 - 10 The correct result I want is this - 510000 - 1200.20 - 843.20 - 50.00 - 46.86 - 10 Originally on the phpmyadmin table, the data is stored under the type "TEXT". Tried "VARCHAR(255)", still don't work. I want to change it to "INT(255)" since I learned that Interger are for numbers but if I changed it, I might risk the data too cause there's decimals in it. Furthermore I'm working on a LIVE website, so have to be very careful. Any ideas? please help.
  17. I manage to solve it by my own finally... and thanks to Tizag for the example. I just don't get it why everyone is showing the tougher complex method when there's a shortcut to it. Anyway... sharing the coding if anyone interested. function DAY_OF_EXPIRED() { $FIND = mysql_query("SELECT * FROM setting WHERE title = 'days to expire'"); $FOUND = mysql_fetch_array($FIND); return $FOUND['value']; // 30 } $Expired_On = date('YmdHi', strtotime('+'.DAY_OF_EXPIRED().' days')); // 201002161133 $day = substr($Expired_On, 6,-4); // 16 $month = substr($Expired_On, 4,-6); // 02 $year = substr($Expired_On, 0,-; // 2010 $Before_Expired= mktime(0, 0, 0, $month, $day-'.DAY_OF_EXPIRED().', $year); echo date("d m y", $Before_Expired);
  18. ok sure, cool... Like I said... Didn't think I'll get much help here anyway. But thank for ur time.
  19. I learn from trials of errors and people's coding. I'm more to practical person. not theory. but thanks anyway.
  20. Ops sorry typo... my bad function DAY_OF_EXPIRED() { $FIND = mysql_query("SELECT * FROM setting WHERE title = 'expire date'"); $FOUND = mysql_fetch_array($FIND); return $FOUND['value']; } The first code I show at the beginning is $Expired_On = date('YmdHi', strtotime('+30 days')); // results: 201002161133 In which if i combine the function would be $Expired_On = date('YmdHi', strtotime('+'.DAY_OF_EXPIRED().' days')); // results: 201002161133 Is it possible using the same method as above for your codes.
  21. Oh sh*t... sorry bro, don't think this will work. I just discovered something in the website admin panel. There's a setting field for changing the number of days. based from your codes and the earlier ones I've posted, it dont work. $PROPERTY = "201002161133"; //$thirty = 30 * 24 * 60 * 60; $propminus30 = strftime("%Y%m%d",strtotime($PROPERTY) - ' . $DAY_OF_EXPIRED() . ' days); echo $propminus30;
  22. Bro, appreciate your help but in the early stage of the post, I've already stated that I cannot edit the sql database. It's a running website with hundreds of entries everyday. Unless I want to get myself sued, then I can follow your method. The only way I can pull this off is to minus off the 30days from 201002161133 on that very spot. I was given a green light to edit only one file... nothing else. :-\ I came up with this few hours ago. $PROPERTY = "201002161133"; $day = substr($PROPERTY, 6,-4); // 16 $month = substr($PROPERTY, 4,-6); // 02 $year = substr($PROPERTY, 0,-; // 2010 Now, how do I go about from here is the 6 dollar question.
  23. Hm... it's ok. Didn't think I'll get much help here. Literally like I said, I am dumb at anything related to date and time. So if you say unixtimestamp and all that, I don't even know what that means. :'(
  24. I'm sorry but I'm a little dumb about using anything related with time and date... which is the reason why I come here asking for help. Can u rephrase cause I don't quite understand.
×
×
  • 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.