Jump to content

WebStyles

Members
  • Posts

    1,216
  • Joined

  • Last visited

Everything posted by WebStyles

  1. I'm wondering what will happen if I try to insert Chinese characters in your database
  2. Ah, I hadn't seen the gallery. Just checked it out. What, no Sly Stallone? Personally I think the Melon image rocks... Php coders love water melon... don't they?
  3. as the manual says:
  4. <?php $file = file_get_contents('http://en.wikipedia.org/wiki/Liverpool_F.C.', true); $pos = strpos($file,'<tr class="vcard agent">'); echo substr($file,$pos); ?>
  5. your question was: The code I gave you search for rows where id=$id and category=$cat... so, if there's no match, it will return empty.
  6. well, that's hardly the example you gave in your first post... You had simple arrays, and now you have mulch-dimensional arrays, there's a big difference.
  7. there's some benchmarking tests done here: http://stackoverflow.com/questions/555523/file-get-contents-vs-curl-what-has-better-performance Don't know how valid they are, but it seems curl is faster.
  8. mysql_query("select `field1`,`field2` from `table` where `id` = '$id' and `category`='$cat'");
  9. You could use strpos to find the position of the first occurrence.
  10. shold be something like: (depending on your array structure) foreach($remainingteams as $teamid => $value){ echo '<option value="' . $teamid . '">' . $teamid .' - '. $value['teamcity'] . '</option>'; }
  11. This is the encoding problems I see: hope this helps
  12. you can do an md5 on the email... imagine you link becomes: delete.php?id=5&e=XXXKDGDHFGFTSGSJAAS (simulating md5 hash of email) then instead of deleting straight away, you first grab the email with id number = 5, apply md5 to it and check if result is the same as $_GET['e'], if it is, you're good to go. this way, a hacker would need to know the person's email, and also their id in the database. You could also add salt to your hash to make it even more secure.
  13. I've noticed that a strange amount of users have the same Bob Marley photo as their avatar... Just wondering if this is a default forum setting (and why Bob) or if it's a coincidence.
  14. I'm doing this based on your initial post, assuming the ranges are from 1.000 to 1.089, so there are 99 possible values. but we only need to worry about 3 of them 1. difference < 2 either way = green 2. difference > 2 and < 5 either way = yellow 3. difference > 4 either way = red <?php $diff = abs($Desiredsalinity2 - $Actualsalinity) * 1000; if($diff < 2){ // echo 'GREEN'; $actualsalinitycolor = $diarygreen; $salinitymessage=$salinitygreenmessage; $salinityadvice=$salinityadvicegreen; }else if($diff < 5){ // echo 'YELLOW'; $actualsalinitycolor = $diaryyellow; $salinitymessage=$salinityyellowmessage; $salinityadvice=$salinityadviceyellow; }else{ // echo 'RED'; $actualsalinitycolor = $diaryred; $salinitymessage=$salinityredmessage; $salinityadvice=$salinityadvicered; } ?>
  15. this variable holds the query: $checkActiveQuery = mysql_query("SELECT * FROM users WHERE user=adf"); this variable fetches the results from your query $Result = mysql_fetch_assoc($checkActiveQuery); this variable grabs a specific field from the returned array $accountStatus = Result['user']; this error means your query failed
  16. if you're expecting several results, you need to loop through them: function getanimestatus(){ $res = array(); $query = mysql_query("SELECT designation FROM agi_status"); while($result = mysql_fetch_array($query)){ $res[] = $result['designation']; } return $res; }
  17. your code is NOT the same as mine. I said: $status = $result['field_name']; // SHOULD BE THE NAME OF THE DB FIELD THAT HOLDS THE VALUE 'BANNED', 'ACTIVE' or 'INACTIVE' and then you check that specific value: if ($status == "INACTIVE"){
  18. please post the exact code you're using when you get that error.
  19. ok. what exactly are the color options? red if difference is greater than .003 yellow if difference is only .001 green if there is no difference. what about when difference is .002 ?
  20. man, that was just an EXAMPLE you could adapt for your needs. Of course the values would come from a database or something. it was just a way to narrow down the differences to one single digit, making it easier for you to define results for each range. (since you were stuck with the precision thing)
  21. array_diff
  22. why not use something like this: <?php $desiredsalinity = 1.010; $salinity = 1.080; $diff = abs($desiredsalinity - $salinity) * 1000; if($diff == 0){ echo "green"; }else if($diff == 1){ echo "yellow"; }else if($diff >= 3){ echo "red"; } ?>
  23. precision = 100.
  24. you have round precision set to 10;
  25. Is that your entire code? where does $sifre come from?
×
×
  • 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.