Apologies if I have entered this incorrectly. I am a newcomer.
I have been presented with a database of Fuchsia Information
[COLOR=“Blue”]http://www.americanfuchsiasociety.org/linktoregistrationdatabase.php[/COLOR]
Many of the cuiltivars include apostrophes and although I have no problems in inputting the data or retreiving a complete list or even a list of fuchsias with the same beginning letter. For example the code will retrieve ‘Barbara’s Gem’ as well as ‘Barbara’
Code for retrieving Fuchsias with same initial letter (This works)
[COLOR=“Red”]<form action=“letterfind.php” method=“post”>
Input Letter:
<input type=text name=“letter”><br>
<input type=submit value=“Submit!”>
</form>
$letter = $_POST[‘letter’];
$letter = $letter.'%';
$query = "SELECT * FROM RegList where Cultivar like '$letter' ";
$result = mysql_query($query);
?>[/COLOR]
However if I try to retrieve a single cultivar containing an apostrophe i.e. ‘Barbara’s Gem’ I receive the following error
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/afs/public_html/singlecultivar.php on line 14
offending line
$num=mysql_numrows($result);
By Cultivar
[COLOR=“Red”]<form action=“singlecultivar.php” method=“post”>
Input Cultivar:
<input type=text name=“letter”><br>
<input type=submit value=“Submit!”>
</form>
$letter = $_POST[‘letter’];
$letter = $letter;
$query = "SELECT * FROM RegList where Cultivar REGEXP "$letter"/";
$result = mysql_query($query);
$num=mysql_numrows($result); [/COLOR]
Any advice please
thanks
Tony