getting string that contains apostrophe
getting string that contains apostrophe
getting string that contains apostrophe
getting string that contains apostrophe
getting string that contains apostrophe
getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe
getting string that contains apostrophe getting string that contains apostrophe
getting string that contains apostrophe
Go Back  Xtreme Visual Basic Talk > > > getting string that contains apostrophe


Reply
 
Thread Tools Display Modes
  #1  
Old 07-13-2012, 12:09 PM
starmanMike starmanMike is offline
Junior Contributor
 
Join Date: Oct 2005
Location: near Norwich, UK
Posts: 294
Default getting string that contains apostrophe


Hi,
I don't have a problem SENDING an apostrophe-containing string to a MySQL database using the form attached. That's fine...I looked at the database and it contains the name of my dummy member as:
Mike O'Dwyer
and doing an 'echo' shows the string sent as:
Mike O\'Dwyer
the problem comes when I try and DISPLAY this string on a form.
I have a page which contains a form, but at the top of the page is a little bit of PHP which displays the person's name:
Code:
$conn = dbconnect('member');
$showrow = "select * from clubs where username='$_SESSION[sessuser]'";
$result = mysql_query($showrow) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
$theun = $row['username'];
$thepw = $row['password'];
$thefn = ucwords($row['fname']);
$thephone = $row['landline'];
$themobile = $row['mobile'];
$themail = $row['email'];
$theclub = ucwords($row['club']);
}
and then on the page itself, this (which works as in the attached screenshot):
Code:
<h2>Member Details for <?php echo $thefn ?></h2>
However, in the form, which contains values retrieved from a MySQL query, everything is OK apart from that field which contains an apostrophe.
This is the relevant line:
Code:
<tr><td class="boldright">Name </td>	<!-- name box -->
<td><?php echo "<input type='text' name='fname' value='$thefn' size='30' maxlength='30'>"; ?></td></tr>
But in this case the variable $thefn is only getting the result of the query up to the apostrophe after the O of O'Dwyer. How can it show it as correct in one place but not in the other?
PS - I have blanked out some values for security reasons, but they are retrieved for this member from the DB.
Attached Images
File Type: jpg screenshot.jpg (38.2 KB, 3 views)
Reply With Quote
  #2  
Old 07-25-2012, 10:23 PM
MikeJ's Avatar
MikeJgetting string that contains apostrophe MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

Try the stripslashes() function.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
getting string that contains apostrophe
getting string that contains apostrophe
getting string that contains apostrophe getting string that contains apostrophe
getting string that contains apostrophe
getting string that contains apostrophe
getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe getting string that contains apostrophe
getting string that contains apostrophe
getting string that contains apostrophe
 
getting string that contains apostrophe
getting string that contains apostrophe
 
-->