bluedaniel
Members-
Posts
37 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
bluedaniel's Achievements
Newbie (1/5)
0
Reputation
-
Ive got this: RewriteRule ^recipes/compare/([0-9]+)-([0-9]+)/?$ compare.php?recipeID=$1&compare2=$2 [NC,L] # Handle recipe requests So http://www.whatcouldicook.com/recipes/compare/1169-1110 does work, but I want http://www.whatcouldicook.com/compare.php?recipeID=1169&compare2=1110 to be redirected instantly without the user knowing
-
From a GET form this URL appears: http://www.whatcouldicook.com/compare.php?recipeID=1169&compare2=1110 I need that to look like: http://www.whatcouldicook.com/recipes/compare/1169-1110 I just cant get the .htaccess code right
-
[SOLVED] Yet another script that works in Firefox and not IE
bluedaniel replied to bluedaniel's topic in PHP Coding Help
excellent! Thank you so much. Working (and now universal!) code: $filetype = $_FILES["uploaded_pic"]["type"]; $acceptablefiletypes = array("image/pjpeg", "image/jpeg", "image/jpg"); if (in_array($filetype, $acceptablefiletypes) && ($_FILES["uploaded_pic"]["size"] < 1000000)) { -
[SOLVED] Yet another script that works in Firefox and not IE
bluedaniel replied to bluedaniel's topic in PHP Coding Help
oh man how much easier would our lives be with one browser!!! your right IE is image/pjpeg while Firefox image/jpeg, and one does not satisfy both browsers, how should my code look then? -
This is an picture upload script that works in Firefox but not IE. Im only uploading a part of the script that I think is the culprit, if you need to see more I will oblige The error in IE is "Im sorry you can only upload a JPG which is under 1MB in size" which is outputted at the end of the script. <?php if (isset($_POST['upload'])) { if (isset($_FILES['uploaded_pic'])) { $id = $_POST['recipeID']; $filename = basename($_FILES['uploaded_pic']['tmp_name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (($_FILES["uploaded_pic"]["type"] == "image/jpeg") && ($_FILES["uploaded_pic"]["size"] < 1000000)) { //Code not uploaded } else { $message = "Im sorry you can only upload a JPG which is under 1MB in size."; } } } ?> any ideas?
-
[SOLVED] Split a string into words, then add a * onto each word
bluedaniel replied to bluedaniel's topic in PHP Coding Help
thanks so much for your help! -
[SOLVED] Split a string into words, then add a * onto each word
bluedaniel replied to bluedaniel's topic in PHP Coding Help
yeah thats what I thought, to make it even more complicated I wanted a mix of Sort by Relevance and Ingredient count combined. Got the relevance sorted with "SELECT *,MATCH(Ingredients) AGAINST ('+$sqlinclude -$sqlexclude' IN BOOLEAN MODE) AS relevance FROM `recipes` WHERE MATCH(Ingredients) AGAINST ('+$sqlinclude -$sqlexclude' IN BOOLEAN MODE) ORDER BY relevance DESC" If anyone has any clues as how to go about this feel free to post! Thanks for your help p2grace anyway! my website is http://www.whatcouldicook.com/ and the code is used on the recipe finder on the first page, give it a try if you like cooking!! -
[SOLVED] Split a string into words, then add a * onto each word
bluedaniel replied to bluedaniel's topic in PHP Coding Help
lol your right that is a lot closer! its missing the + symbol at the beginning of each word but I think I can fix that. Are you good with FULLTEXT? im really learning quick and getting better results each time, I wanted to return my results with a COUNT of line breaks in the Ingedients field with the lowest count coming first, any ideas what direction I should take? -
[SOLVED] Split a string into words, then add a * onto each word
bluedaniel replied to bluedaniel's topic in PHP Coding Help
Working example based on your second method: $include = "0"; if (isset($_GET['include'])) { $include = $_GET['include']; $filter_array = array(", ", "\r", "\n"); $hello .= $include."*"; $sqlinclude = mysql_real_escape_string(str_replace($filter_array,"* +",$hello)); } The output of the first logic: SELECT Title, SmallDesc, id, picturesmall FROM recipes WHERE MATCH (Ingredients) AGAINST ('+ -' IN BOOLEAN MODE) AND type='0' It breaks completley -
[SOLVED] Split a string into words, then add a * onto each word
bluedaniel replied to bluedaniel's topic in PHP Coding Help
I was hoping for a foreach loop as I feel it might be more robust (is it?) but the first method doesnt work, Ive already tried the second method although it doesnt add a star to the last word in the string as it doesnt have a comma after it. I could just add a star to the end of the string but is there a simpler way for the foreach loop? -
[SOLVED] Split a string into words, then add a * onto each word
bluedaniel replied to bluedaniel's topic in PHP Coding Help
The php GET code: $include = "0"; if (isset($_GET['include'])) { $include = $_GET['include']; $filter_array = array(", ", "\r", "\n"); $sqlinclude = mysql_real_escape_string(str_replace($filter_array," +",$include)); } The SQL code: $query_finder = "SELECT Title, SmallDesc, id, picturesmall FROM recipes WHERE MATCH (Ingredients) AGAINST ('+$sqlinclude -$sqlexclude' IN BOOLEAN MODE) AND type='$type'"; I need to split $include into words, add a + before and a * after so "Chicken, tomato" becomes "+Chicken* +tomatoes*" now i get +Chicken +tomato -
So im doing a FULL TEXT Boolean search with multiple values from one string which should be split using a comma although perhaps spaces should also be included for simplicity. Also each word should have a + symbol before each word. $filter_array = array(", "); $sqlinclude = mysql_real_escape_string(str_replace($filter_array," +",$include)); Right now its basic, so "Chicken, tomato" becomes "+Chicken +tomato" as there is a + symbol at the start of the statement in SQL. The star at the end would mean that "tomato" also becomes "tomatoes" which is very important. Thanks guys
-
[SOLVED] Need help with an Ajax script, probably simple
bluedaniel replied to bluedaniel's topic in Javascript Help
ok so php file: <?php echo sprintf( '<input type="hidden" name="hdnTest" id="hdnTest" value="%s" />', htmlentities( $userid, ENT_QUOTES ) ); ?> javascript file: var userid = ( document.getElementById( 'hdnTest' ).value ); //get the value var pars = 'id='+obj.id+'&content='+new_content+'&userid='+userid; //send it to the third php page thanks people! -
[SOLVED] Need help with an Ajax script, probably simple
bluedaniel replied to bluedaniel's topic in Javascript Help
got it sorted now, my site is mainly php but this script is a very nice addition. how do i mark it solved? -
[SOLVED] Need help with an Ajax script, probably simple
bluedaniel replied to bluedaniel's topic in Javascript Help
Im good enough at breaking down code to know thats the part that needed editing but I just dont know what parameters, sticking a variable which is already defined in php isnt difficult is it?