Jump to content

taquitosensei

Members
  • Posts

    676
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by taquitosensei

  1. Here's a way to clean this up quite a bit. <option value="0" selected>Feet +0</option> <option value="1">Goat +1</option> <option value="2">Donkey +2</option> <option value="3">Cow +3</option> <option value="4">Pig +4</option> <option value="5">Horse +5</option> switch($_POST['direction']) { case "north": $add=True; $direction="longitude"; break; case "south": $add=False; $direction="longitude"; break; case "east": $add=True; $direction="latitude"; break; case "west"; $add=False; $direction="latitude"; break; } switch($_POST['speed']) { switch($add) { case True: $$direction++; $$direction=($$direction > ($controlrow["gamesize"]*($_POST['speed']+1)))? ($controlrow["gamesize"]*($_POST['speed']+1):$$direction; break; case False: $$direction--; $$direction=($$direction > ($controlrow["gamesize"]*($_POST['speed']+1)))? ($controlrow["gamesize"]*($_POST['speed']+1):$$direction; break; } break; } The layouts was messed up when I posted this but you get the idea.
  2. I test that here and mine comes back en-us which would fall under default. I would echo out the $languages[0] just before your case to make sure it's the value you're expecting. It also might have to do with the case 'zh-cn'||'zh-hk'||'zh-mo'||'zh-sg'||'zh-tw'||'zh': // china if I'm matching multiple I usually do something like this. case 'zh-cn': case 'zh-hk': case 'zh-mo': case 'zh-sg': case 'zh-tw': case 'zh':
  3. yes. Just start typing and try it. You'll either get an error or it will work. If the output doesn't look like you want. Adjust the query.
  4. just an FYI judging from screenshots. phpmyadmin is your MySQL client. You can always test your queries there to see if the output is what you're after. You can then adjust the query and test it before even touching php.
  5. you probably have more than one level per subject. Run your query in your mysql client and you'll see.
  6. You left off the closing parenthesis on your values.
  7. yup ($hours*60)+$minutes
  8. Store it as Minutes only sort by minutes and convert to Hours Minutes when you display it. 150 Minutes $minutes=150; echo floor($minutes/60)." Hour(s) ".($minutes%60)." Minute(s)"; // 2 Hour(s) 30 Minute(s)
  9. does the file also have linebreaks ("\r" or "\r\n") Does it look like this. This is the first line<br>Second line is here<br>something else<br>something else<br>something more<br> or does it look your example?
  10. is $api an array instead of an object if so $name=$api['data'][0]['name']; you'd have to loop to access them all
  11. in your mysql client update table set field=replace(field,"[url_REFERENCE]",""); if you want to get ride of the &p= also update table set field=replace(field,"[url_REFERENCE]&p=",""); I would try it on some test data first to make sure the brackets and ampersand don't screw anything up. I just noticed you said cron job. You could have a php script run this then use a cron job to run the php script.
  12. Write it to a file instead of ouputting the headers. function createCSV() { $now=date("d-m-Y,H:i:s", time()); $fh=fopen("emails_".$now.".csv","a"); include("dbconnect.php"); $query = "SELECT `EmailAddress` , `Name` , `FirstName` , `LastName` FROM directtable;"; $rsSearchResults = mysql_query($query) or die(mysql_error()); $fields = mysql_list_fields($dbDatabase,'directtable'); $columns = mysql_num_fields($fields); // Put the name of all fields for ($i = 0; $i < $columns; $i++) { $l=mysql_field_name($fields, $i); fwrite($fh, '"'.$l.'",'); } fwrite($fh,"\n"); // Add all values in the table while ($l = mysql_fetch_array($rsSearchResults)) { for ($i = 0; $i < $columns; $i++) { fwrite($fh,'"'.$l["$i"].'",'); } fwrite($fh,"\n"); } // Output to browser with appropriate mime type, you choose //header("Content-type: text/x-csv"); //header("Content-type: text/csv"); //header("Content-type: application/csv"); //$now=date("d-m-Y,H:i:s", time()); //header("Content-Disposition: attachment; filename=emails_".$now.".csv"); //echo $out; fclose($fh); }
  13. in your sql order by name
  14. I guess you learn something new everyday.
  15. probably substr the last 15 $date="Sun, 16 Jan 2011 00:00:00 -0800"; $date=substr($date,-15); /// this would give you "Sun, 16 Jan 2011" $date=substr($date,0,5); // "16 Jan 2011" $timestamp=strtotime($date); then you can format it and do whatever you want from there $formatted_date=date("Y-m-d", $timestamp); // 2011-01-16
  16. you have the brackets after countries. So you're countries would be index 0 of $_POST['countries'] drop the brackets or refer to $_POST['countries'][0];
  17. do print_r($_POST); just before you set the $countries this will tell you whether it's being posted or not. Everything looks correct. But it's possible you didn't set your form to post. Or this is outside of the form.
  18. Yes it is. Personally I would have just tried it. If it didn't work I learned/unlearned something new. That's the best way to learn. Just Do It.
  19. Don't surround it in single quotes. Try this $sq = "INSERT INTO articles(original_text) VALUES ('".$element."') WHERE article_link='".$item_url."'"; single quotes don't parse and would insert the value "$element" instead of the contents of it.
  20. show us the code. That way we can look and see where the problem might be.
  21. Make sure that send is True. If it is then add an exit after the redirect. if($from == '') {print "You have not entered an email, please go back and try again";} else { if($name == '') {print "You have not entered a company name, please go back and try again";} else { $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) { echo "Send is true."; die(); // if you get this then remove this line and try it again. header( "Location: http://www.hillsideweb.co.uk/unsubthanks.html" ); exit; }
  22. It's probably because I put $a>0 and it should be 1 for($a=1;$a<=4; $a++) { $glue=($a>1)?", ":""; $to1.=($_GET['e'.$a]!='')?$glue.$_GET['e'.$a]:""; }
  23. It looks like you're running your file in htdocs and need to drop the "../" from the relative path.
  24. try this for($a=1;$a<=4; $a++) { $glue=($a>0)?", ":""; $to1.=($_GET['e'.$a]!='')?$glue.$_GET['e'.$a]:""; }
×
×
  • 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.