Hi On a clients recruitment website, i am displaying the details of a vacancy which includes the salary preceeded by a pound sign. When the job details are entered into the mysql database through a html/php form, it changes the £ sign to £, which is no problem, as when i display the variable on the job detail page it displays the £ sign, which is cool. code here: <?php include("includes/db_connect.inc.php"); $query = "Select * FROM vacancies ORDER BY date_added DESC"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $vacancy_id = mysql_result($result,$i,'vacancy_id'); $job_title = mysql_result($result,$i,'job_title'); $salary = mysql_result($result,$i,'salary'); $location = mysql_result($result,$i,'location'); $terms = mysql_result($result,$i,'terms'); echo " <div class='briefdesc'> <div class='desc_title'> <p class='title_text'>$job_title</p> <p class='title_text'>$terms</p> </div> <div class='desc_details'> <table> <tr> <td class='detail_text'>Location: </td> <td class='detail_text'>$location </td> </tr> <tr> <td class='detail_text'>Salary: </td> <td class='detail_text'>$salary </td> </tr> <tr> <td class='detail_text'>Contract: </td> <td class='detail_text'>$terms </td> </tr> </table> </div> <div class='desc_more'> <a class='viewvacbut' href='view-vacancy.php?vacancy_id=$vacancy_id'><img class='no_marg' src='images/more.png' /></a> </div> </div> "; $i++; } ?> PHP: BUT I am also displaying this job on the homepage as a job of the week, inside a joomla template. The job of the week is not managed inside of joomla, it is just displayed dynamically through my own scripts. But instead of displaying the £ sign for the salary variable, it is showing £. code here: <?php include("includes/db_connect.inc.php"); $query="SELECT * FROM vacancies WHERE jotw = 'yes'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $vacancy_id = mysql_result($result,$i,'vacancy_id'); $job_title = mysql_result($result,$i,'job_title'); $salary = mysql_result($result,$i,'salary'); $location = mysql_result($result,$i,'location'); $terms = mysql_result($result,$i,'terms'); $desc1 = mysql_result($result,$i,'desc1'); $limit_desc1 = substr($desc1,0,200); echo "<table id='jotw_table'> <tr> <td class='jotw_title'>$job_title </td> </tr> <tr> <td class='jotw_title'>$salary </td> </tr> <tr> <td class='jotw_title'>$location </td> </tr> <tr> <td class='jotw_title'>$terms </td> </tr> <tr> <td class='jotw_desc'>$limit_desc1... </td> </tr> <tr> <td><a href='../view-vacancy.php?vacancy_id=$vacancy_id'><img class='no_marg' src='../images/more.png'></a> </td> </tr> </table> "; $i++; } ?> PHP: The 2 scripts displaying the vacancy details are very similar, so i am completely stumped as to why it is displaying differently. All the web pages are encoded utf-8, including the index.php file within the joomla template. Any help is muchly appreciated. cheers
Or £, which is probably easier to remember. Anyway, compare the charsets used on both sites. You might want to take a look at utf8_encode()/utf8_decode().
all chatsets are utf-8? and the scripts are on the same site as the client is enetering this data into a form, they are using the £ sign, so i will need to figure out why it is displaying correctly through 1 script and not the other?
How are you displaying "job of the week" is it an iframe or something ? This is the only problem right ?
yes job of the week is the only problem. No it is not in an iframe, it is inside a joomla template, but not managed from within joomla.
Assuming its salary you could do this, it will decode $salary £ - £ regardless <tr> <td class='jotw_title'>utf8_decode($salary); </td> </tr> Code (markup):
ok, so how would i use this as you have stated? as this is a dynamically displayed table i added what you said but it just outputs - utf8_decode(£22,000); how do i drop out of php to get this to work?
ah solved it now. cheers MyVodaFone, i just decoded the variable before displaying. cheers. Been working on this since this morning. bummer!