Page 2 of 2
Posted: Wed May 25, 2005 4:25 pm
by Addos
Hi,
You are very patient with me.
I have added this also but the echo returns:
locations.counties_IDPK = \'%\'
Again I have made this change to the site at:
http://www.irishmusicteachers.ie/index_test.php
This is also the code for the select box with the changes you suggest:
Code: Select all
<?PHP echo "<select name='Counties_IDPK' id='Counties_IDPK'>\n
<option value=\"'%'\">Search All</option>";
while($dbRow = mysql_fetch_array($rstSearchLocations)){
echo "<option value='"
. $dbRow["Counties_IDPK"]
. "'>"
. $dbRow["Counties_Name"]
."</option>\n";
} echo "</select>\n";
?>
Choose County
Thanks again
B

Posted: Wed May 25, 2005 4:28 pm
by Burrito
Code: Select all
<?PHP echo "<select name=\"Counties_IDPK\" id=\"Counties_IDPK\">\n
<option value=\"'%'\">Search All</option>";
while($dbRow = mysql_fetch_array($rstSearchLocations)){
echo "<option value='"
. $dbRow["Counties_IDPK"]
. "'>"
. $dbRow["Counties_Name"]
."</option>\n";
} echo "</select>\n";
?>
Choose County
try that...
Posted: Wed May 25, 2005 4:31 pm
by Addos
Sorry exact same result

Posted: Wed May 25, 2005 4:35 pm
by Burrito
ok, tried it with something similar I just did and correct you are, same result:
stripslashes() you need around the $_POST var.
Posted: Wed May 25, 2005 4:37 pm
by Burrito
Code: Select all
if ($_POST['Counties_IDPK']) { $query_rstResults .= ' AND locations.counties_IDPK like ' . stripslashes($_POST['Counties_IDPK']); }
sorry for the double post I am, wanted to be sure he got the addition I did...
Posted: Wed May 25, 2005 4:51 pm
by Addos
Ok I have tried adding stripslashes() but the result is showing:
Code: Select all
locations.counties_IDPK = like '%'
Again you can see for yourself.
http://www.irishmusicteachers.ie/index_test.php
I did try removing the word ‘like’ and then got the following which didn’t contain an error but didn’t return all the data in the database for this part of the ‘Search All’
Code: Select all
SELECT * FROM teachers,inst_teach,locations,instruments WHERE teachers.contents_IDPK = inst_teach.teacher_IDFK AND inst_teach.instrument_IDFK = instruments.instruments_IDPK AND teachers.counties_IDFK = locations.counties_IDPK AND locations.counties_IDPK = '%' AND instruments.instruments_IDPK = 65 ORDER BY teachers.contents_IDPK
Thanks a mil and sorry to be such a bother.
B
Posted: Wed May 25, 2005 5:14 pm
by Addos
Ok I hope I caught you in time. The problem is solved. I had to replace the " with ' that I origionally had removed in the test a few posts back e.g. "Counties_IDPK\" is now 'Counties_IDPK\' again and all seems to be working ok.
If you go to the same page now and 'Select All' and Select 'Guitar' all the entries in the database are now returned.
Thanks you very much for this invaluable help. It has been a good lesson and one that I have learned a lot from.
Thanks again
Brian
