Note that there are some explanatory texts on larger screens.

plurals
  1. POTriple slash in PHP MYSQL result
    primarykey
    data
    text
    <p>I have used <code>mysql_real_escape_string</code> to enter info into the database but when I return the info in a query I get <code>\\\'</code> in the text. I have made it so that the insert query does not stop at the <code>'</code> in a sentance anymore when saving as it used to. It used to stop saving he title of an article halfway through if it contained an apostrophe. That has been fixed but now I get <code>\\\'</code> where there is an apostrophe. </p> <p>Example: <code>Microsoft\\\'s $15 Windows 8 upgrade offer to run from June 2nd to January 31st, will include free workshops</code></p> <p>My query code to return a list from the database looks like this: (Note that this is an excerpt so does not contain the closing of this loop)</p> <pre><code>&lt;?php $q2 = "SELECT * FROM ReadLater WHERE Folder_ID = 0 AND User_ID = $loggedInUser-&gt;user_id ORDER BY dt_added DESC"; $r2 = mysql_query($q2); echo "&lt;div id='folderstitleright'&gt;Unread&lt;/div&gt;"; if(mysql_num_rows($r2)&gt;0) { echo "&lt;ul id='foldersarticlelist'&gt;"; $sr2=1; while($row = mysql_fetch_assoc($r2)) { echo " &lt;li class='box'&gt; </code></pre> <p>etc</p> <p>Any idea how to stop this? I have tested to see if magic quotes are on and they are but with the web host I have no way of turning them (that i have found, there may well be a really complicated way but I haven't found it yet) of and they also say they ignore php flags in the .htaccess file.</p> <p>I have tried to do a preg_replace of <code>\\\' to '</code> but have so far been unsuccessful, from what I have tried of that it breaks the query entirely but I may well be executing it wrong or have it placed in the wrong place in the code above.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload