-
Posts
1,216 -
Joined
-
Last visited
Everything posted by WebStyles
-
Look over and test of ajax MYSQL editor?
WebStyles replied to gearsgod's topic in Beta Test Your Stuff!
I'm wondering what will happen if I try to insert Chinese characters in your database -
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?
-
as the manual says:
-
<?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); ?>
-
Details display even if category is types wrong in url
WebStyles replied to $php_mysql$'s topic in PHP Coding Help
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. -
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.
-
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.
-
Details display even if category is types wrong in url
WebStyles replied to $php_mysql$'s topic in PHP Coding Help
mysql_query("select `field1`,`field2` from `table` where `id` = '$id' and `category`='$cat'"); -
You could use strpos to find the position of the first occurrence.
-
shold be something like: (depending on your array structure) foreach($remainingteams as $teamid => $value){ echo '<option value="' . $teamid . '">' . $teamid .' - '. $value['teamcity'] . '</option>'; }
-
Look over and test of ajax MYSQL editor?
WebStyles replied to gearsgod's topic in Beta Test Your Stuff!
This is the encoding problems I see: hope this helps -
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.
-
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.
-
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; } ?>
-
What am I doing wrong in my functions file?
WebStyles replied to cooldood's topic in PHP Coding Help
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 -
Functions returning arrays with mysql data
WebStyles replied to criostage's topic in PHP Coding Help
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; } -
What am I doing wrong in my functions file?
WebStyles replied to cooldood's topic in PHP Coding Help
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"){ -
What am I doing wrong in my functions file?
WebStyles replied to cooldood's topic in PHP Coding Help
please post the exact code you're using when you get that error. -
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 ?
-
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)
-
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"; } ?>
-
you have round precision set to 10;
-
Is that your entire code? where does $sifre come from?