Jump to content

metcaelfe

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

metcaelfe's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the reply kicken. I did try to install the 2012 Native Client, but it will not install on Win 2k3. Rolled back to 5.3 and I got it all sorted. Cheers!
  2. Howdy freaks, I think I have hit a dead end with my attempts to connect to a MSSQL server (2008R2) using PHP (5.4.. I am running PHP through IIS using FastCGI. I believe I have fulfilled the prerequisites but I either get an error informing Native Client 2012 required for driver, or call to unknown function (either mssql_connect() or sqlsr_connect() depending on driver in use - MS Version 2, or 3). PHP is functioning correctly via IIS - phpinfo() works Version 3.1? SQL extensions from Microsoft are installed (added to php.ini) (php_sqlsrv_54_nts.dll && php_pdo_sqlsrv_54_nts.dll) - I have also tried the Version 2.0 DLLs, but these seem not to work at all. SQL Native Client installed (v 10.0) I think the problem is that I am using Windows Server 2003 (x86) and the SQL Native Client 2012 is not supported on 2k3... I cannot install it, only 2008R2 native client, so the 5.4 drivers from MS cannot be used. --------------------------------- I guess I know what I think the answer is, but, can anyone tell me if what I am trying to achieve is even possible? I assume no and that I will need to roll back to PHP 5.3 or something along those lines, I just want to confirm this prior to bursting a few more blood vessels in my eyes on this... Any assistance will be greatly appreciated - if you need screens or more info at all, let me know Thanks all! Cael
  3. Cheers for taking the time to read! Sorry for the long post :-\ To be honest, I haven't touched the code for over a week as I have been too busy, so I think if I really put my mind to it and take another look at it, I will resolve this issue... I only use addslashes() on the string before I INSERT anything... I will try your suggestion and see where I end up... I think this comes down to a limitation of echo() into a <textarea> as the browser will just interpret and not leave me with the text :-( Cheers!
  4. Hello everybody! I am storing HTML in a column which is part of a table containing Knowledge Base articles. I am having some issues with echoing this data in my web gui. Currently, I provide a solution to a client, then I paste the solution straight into MS Frontpage to give me the same text but HTML formatted. I then go to my "New Article" form, paste the HTML from Frontpage straight into a <textarea> and submit to execute the INSERT query. That is all well and good and when I SELECT that for output, the HTML tags (formatting) are all interpreted correctly and the Special Chars/Entities are there too (eg: "<" & ">" in the web browser, which are "<" and ">" in the source code). This works correctly for displaying the articles, as the < > are both displayed as the correct less/greater than symbol (<>) on the web page. THE PROBLEM EXISTS when I wish to EDIT an article. I query and SELECT the row, and the column which contains the HTML is stored in a var then echoed within a <textarea>. The problem is that the browser is interpreting the HTML Entities as the actual char they are. Ie: In the database, the data is: <img src="[uRI OF IMAGE]"> When the article is loaded for viewing, it displays: <img src="[uRI OF IMAGE]"> When I go to edit the article and output the contents of that column to a <textarea>: Displayed in Browser within the textarea: <img src="[uRI OF IMAGE]"> Source code in Browser: <textarea><img src="[uRI OF IMAGE]"></textarea> This then causes a major issue, as once I edit the text, then submit the changes, the value within the <textarea> updates to the column, thus I lose the HTML entities (< >) and instead the actual chars are saved, which means that next time I load that article for viewing, I won't see the code because the browser interprets it as actual HTML (as it should). How can I avoid this? I have tried playing around with: addslashes(); <-- I use this on the var which stores the value to be written to the DB. htmlentities(); <-- Cannot assist as I am using HTML & Entities in the one... htmlspecialchars(); <-- Same as entities, cannot use this as I have HTML tags & Entities in the one... Can anyone offer any advice? Thanks in advance! Cael
  5. Hi Everybody. I hope someone here can advise the correct method for storing html/text in a MySQL DB AND retrieving it for updating via a <textarea> Basically, I need to store in my DB knowlege base articles, which have a title, category, product version/edition, description, solution, notes, etc... standard KB fields.. sorta... The issue I am experiencing, or the trouble I am having, is when I need to store both formatting HTML and output HTML in the solution or notes fields, html special chars are being interpreted and the HTML that should be displayed is not there. The char codes are interpreted and the browser then "hides" the HTML tags. For example, the solution may be this: Find the following line: <serverURL>URL</serverURL> Change the URL to reflect your current server URL. The html chars are interpreted and changed to the actual less than and greater than signs rather than their &...; form (ie: < > &nbsp etc.) Some code snippets if it helps... Creating a record: ... $sol = addslashes($_POST['asol']); $notes = addslashes($_POST['anotes']); include('./conf/connect.php'); mysql_query("INSERT INTO `faq_kb`.`articles` (`id`, `solution`, `notes`, `updated`) VALUES (NULL, '$sol', '$notes', NULL) ") or die(mysql_error()); mysql_close($conn); ... Retrieving a record: ... include('./connect.php'); $get = $_GET['a']; $sql = "SELECT * FROM articles WHERE id='$get'"; $result = mysql_query($sql); mysql_close($conn); while($row=mysql_fetch_array($result)) { $solution = $row['solution']; $notes = $row['notes']; } ... <h4>Solution:</h4> <div align="right"><textarea name="rsol" style="width:550px;height:150px;"> <?php echo $solution; ?> </textarea></div> <h4>Notes:</h4> <div align="right"><textarea name="rnotes" style="width:550px;height:150px;"> <?php echo $notes; ?> </textarea></div> ... Updating a record: ... $aid = $_POST['id']; $sol = addslashes($_POST['rsol']); $notes = addslashes($_POST['rnotes']); include('./conf/connect.php'); mysql_query("UPDATE `faq_kb`.`articles` SET solution='$sol', notes='$notes' WHERE id='$aid'") or die(mysql_error()); mysql_close($conn); ... I guess, you can ignore my whole spiel above and simply answer this question: what function do I need to use to encode the variable for inserting into the database, and what function do I then need to use to decode the variable for output so that it retains it's formatting html and my output/displayed html (< >)??? Thanks guys! I hope that this makes sense... ------------------------ Further Example: This is what is output (inside the dashes): ---------------------------- To configure your SysAid Server logging to debug mode please do the following. Open the file serverConf.xml located in the directory: [...\SysAidServer\root\WEB-INF\conf\] Change <sysaidLogLevel>info</sysaidLogLevel> to <sysaidLogLevel>debug</sysaidLogLevel> Save the change and then restart the SysAid Server service. -------------------------- And this is what the source of that looks like: <div class="divText" id="txtselect"><p> <span style="font-size: 10pt; font-family: 'Times New Roman',serif; color: black;" lang="EN-US"> To configure your SysAid Server logging to debug mode please do the following.</span></p> <p><font size="2"><span style="font-family: 'Times New Roman',serif;">Open the file </span></font> <span style="font-size: 10pt; font-family: 'Times New Roman',serif; color: black; font-style: italic;" lang="EN-US"> serverConf.xml</span><span style="font-size: 10pt; font-family: 'Times New Roman',serif; color: black;" lang="EN-US"> located in the directory:</span></p> <p><font size="2"><span style="font-family: 'Times New Roman',serif;"> </span></font> <span style="font-size: 10pt; font-family: 'Times New Roman',serif; color: black;" lang="EN-US"> [...\SysAidServer\root\WEB-INF\conf\] </span></p> <p> <span style="font-size: 10pt; font-family: 'Times New Roman',serif; color: black;" lang="EN-US"> Change <br> </span><font face="Courier New"> <span style="font-size: 10pt; color: black;" lang="EN-US"> <sysaidLogLevel>info</sysaidLogLevel><br> </span></font> <span style="font-size: 10pt; font-family: 'Times New Roman',serif; color: black;" lang="EN-US"> to<br> </span><font face="Courier New"> <span style="font-size: 10pt; color: black;" lang="EN-US"> <sysaidLogLevel>debug</sysaidLogLevel></span></font></p> <p><span style="font-size: 10pt; color: black;" lang="EN-US">Save the change and then restart the SysAid Server service.</span></p> </div> And this is a copy paste straight out of phpMyAdmin: <p> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> To configure your SysAid Server logging to debug mode please do the following.</span></p> <p><font size="2"><span style="font-family: 'Times New Roman',serif">Open the file </span></font> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black; font-style: italic"> serverConf.xml</span><span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> located in the directory:</span></p> <p><font size="2"><span style="font-family: 'Times New Roman',serif"> </span></font> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> [...\SysAidServer\root\WEB-INF\conf\] </span></p> <p> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> Change <br> </span><font face="Courier New"> <span lang="EN-US" style="font-size: 10.0pt; color: black"> <sysaidLogLevel>info</sysaidLogLevel><br> </span></font> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> to<br> </span><font face="Courier New"> <span lang="EN-US" style="font-size: 10.0pt; color: black"> <sysaidLogLevel>debug</sysaidLogLevel></span></font></p> <p><span lang="EN-US" style="font-size: 10.0pt; color: black">Save the change and then restart the SysAid Server service.</span></p> Then EVEN CRAZIER, I click the edit button on the article and this is (direct copy paste) what is output to the <textarea>: <p> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> To configure your SysAid Server logging to debug mode please do the following.</span></p> <p><font size="2"><span style="font-family: 'Times New Roman',serif">Open the file </span></font> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black; font-style: italic"> serverConf.xml</span><span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> located in the directory:</span></p> <p><font size="2"><span style="font-family: 'Times New Roman',serif"> </span></font> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> [...\SysAidServer\root\WEB-INF\conf\] </span></p> <p> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> Change <br> </span><font face="Courier New"> <span lang="EN-US" style="font-size: 10.0pt; color: black"> <sysaidLogLevel>info</sysaidLogLevel><br> </span></font> <span lang="EN-US" style="font-size: 10.0pt; font-family: 'Times New Roman',serif; color: black"> to<br> </span><font face="Courier New"> <span lang="EN-US" style="font-size: 10.0pt; color: black"> <sysaidLogLevel>debug</sysaidLogLevel></span></font></p> <p><span lang="EN-US" style="font-size: 10.0pt; color: black">Save the change and then restart the SysAid Server service.</span></p> Notice how there are NO < or > chars in this? How do I make this work :( Thanks guys
  6. Howdy everyone! Name's Cael, from Sydney Australia and I work for SysAid Australia P/L. Self taught multiple markup languages and server side scripting, however, often run in to a few difficult situations that require a little bit of research (not to mention trial and error) to overcome! Anyway, joined because I would like to interact with like minded, self-taught and fully decorated PHPFREAKS!!! Looking forward to it! Cael
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.