![]() |
|
|||||||||
|
|||||||||
|
| Attention Visitor: |
| You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
||||||
| PHP DB Discutii despre lucrul cu baze de date in PHP. |
![]() |
|
|
Thread Tools | Moduri de afișare |
|
|
#1 |
|
64-Bit member
|
http://ro.php.net/manual/en/function...et-charset.php
In documentatie zice ca pot folosi functia mqsqli_connect in MySQL 4.1.1 si eu am MySQL 4.1.18 dar cand rulez scriptul am eroarea: Fatal error: Call to undefined function: mysqli_connect(). Stie cineva de ce? Ceea ce vreau de fapt sa fac este sa fac sa apara diacritiile unui text luat din mysql. Am introdus linia Cod:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
__________________
http://aventuriledox.com < cartile tale preferate http://innovation.lx.ro < Cereri pagini web http://buy.bro.ro < Publica un anunt |
|
|
|
| Sponsored Links |
|
|
#2 |
|
64-Bit member
Data înregistrării: 21.03.2006
Mesaje: 209
Rep Power: 0 ![]() |
De ce folosesti mysqli? (MySQL Improved) Nu merge pentru ca nu ai compilata extensia mysqli pentru php (sau in cazul in care rulezi php pe windows, nu ai incarcata extensia).
Cat despre problema ta cu diacriticele, sunt mai multe puncte unde pot aparea probleme. 1. headerul setat ca utf-8 2. apache-ul sa nu fie configurat sa ignore cererile pentru alt charset. 3. adaugarile in db mysql sa se faca numai utf-8 4. mysql sa fie in modul utf-8. Cel mai bine iti recomand un manual, pentru ca caracterele multibyte sunt o problema inca spinoasa. |
|
|
|
|
|
#3 |
|
64-Bit member
|
daca bag codul pentru header :
Cod:
<?php
header("Content-Type: text/html;charset=utf-8");
?>
Warning: Cannot modify header information - headers already sent by (output started at /home/rzv/public_html/carti.php:1) in /home/rzv/public_html/carti.php on line 2 daca trebuie facute modificari la apache, eu ca utilizator pot sa schimb setarea?cred ca nu dar tt intreb
__________________
http://aventuriledox.com < cartile tale preferate http://innovation.lx.ro < Cereri pagini web http://buy.bro.ro < Publica un anunt |
|
|
|
|
|
#4 |
|
64-Bit member
Data înregistrării: 21.03.2006
Mesaje: 209
Rep Power: 0 ![]() |
Pai linia de header() trebuie adaugata inainte de orice linie care este trimisa browserului, vezi sa fie inainte de orice include-uri care pot genera cod (la erori de ex).
Modificarea la apache tine de un .htaccess din cate stiam eu, daca iti este permis htaccess probabil ca merge. |
|
|
|
|
|
#5 |
|
64-Bit member
|
poi headerul e imediat dupa tagul php de inceput (<?php).
<?php header("Content-Type: text/html;charset=utf-8");?> dar primesc eroarea: Warning: Cannot modify header information - headers already sent by (output started at /home/rzv/public_html/carti.php:1) in /home/rzv/public_html/carti.php on line 1 ceea ce arata ca e pe prima linie dar tot nu merge. Nu inteleg de ce si de asemenea afisez continutul htmlacces: Cod:
# -FrontPage- IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> AuthName www.aventuriledox.com AuthUserFile /home/rzv/public_html/_vti_pvt/service.pwd AuthGroupFile /home/rzv/public_html/_vti_pvt/service.grp
__________________
http://aventuriledox.com < cartile tale preferate http://innovation.lx.ro < Cereri pagini web http://buy.bro.ro < Publica un anunt |
|
|
|
|
|
#6 |
|
64-Bit member
Data înregistrării: 21.03.2006
Mesaje: 209
Rep Power: 0 ![]() |
Fisierul carti.php il incluzi in alt fisier cumva?
|
|
|
|
|
|
#7 |
|
64-Bit member
|
Nu
sunt absolut sigur. Atasez codul sursa a paginii. Fisierul config.php nu contine decat conectarea la mysql. Fisierul meniu.php contine JS pe post de meniu. Singurul link catre carti.php este din acel meniu. linkul ese de forma ...carti.php?nrcarte=1 , iar de aici in functie de valoarea lui nrcarte sa afiseaza valorile din mysql Am observat de asemenea ca in firefox imi este afisat caracterul -(utilizat ca linie de dialog in scrierea pe romana) pe cand in opera si ie nu Chiar nu imi pot da seama ca poate fi... Cod:
<?php header("Content-Type: text/html;charset=utf-8");?>
<html>
<head>
<title>Untitled Document</title>
<link href="./css/pozaheader.css" rel="stylesheet" type="text/css">
<link href="./css/bordere.css" rel="stylesheet" type="text/css">
<link href="./css/textdescriere.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style4 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<?php
require_once('./Php/config.php');
$nrcarte=$_GET['nrcarte'];
$cerereSQL = 'SELECT * FROM carti WHERE id='.$nrcarte;
$rezultat = mysql_query($cerereSQL) or die('Error, query failed');
while($rand = mysql_fetch_assoc($rezultat)) {
$titlu=$rand['titlu'];
$documentare=$rand['documentare'];
$img1src=$rand['img1src'];
$text1=$rand['text1'];
$img2src=$rand['img2src'];
$text2=$rand['text2'];
$img3src=$rand['img3src'];
$text3=$rand['text3'];
$img4src=$rand['img4src'];
$text4=$rand['text4'];
};
?>
<body>
<table width="790" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="143" colspan="5" valign="top" bgcolor="#990100"><img src="./poze/header.jpg" alt="heADER" width="790" height="143"></td>
</tr>
<tr>
<td height="19" colspan="5" bgcolor="#FFFFFF" >
<?php include("meniu.php");
?></td>
</tr>
<tr>
<td height="36" colspan="5" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="25" colspan="5" valign="top" class="bordersus"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td width="34" rowspan="11" align="center" valign="middle" bgcolor="#990100"><!--DWLayoutEmptyCell--> </td>
<td height="19" colspan="3" valign="top" bgcolor="#990100"><!--DWLayoutEmptyCell--> </td>
<td width="33" rowspan="11" valign="top" bgcolor="#990100"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="19" colspan="3" valign="top" bgcolor="#990100"><span class="bordere3">
<?php
echo $titlu;
?>
</span></td>
</tr>
<tr>
<td height="6" colspan="3" valign="top" bgcolor="#990100"><hr>
<p class="style4">ăîţşâî</p> </td>
</tr>
<tr>
<td width="256" height="37" valign="top" bgcolor="#990100" class="bordere3">
<?php
echo '<img src="'.$img1src.'">';
?> </td>
<td width="31" rowspan="2" valign="top" bgcolor="#990100"><!--DWLayoutEmptyCell--> </td>
<td width="436" valign="top" bgcolor="#990100" class="textdescriere">
<span class="bordere3">
<?php
echo $text1;
?>
</span>
</td>
</tr>
<tr>
<td height="19" bgcolor="#990100"> </td>
<td height="19" valign="top" bgcolor="#990100" class="textdescriere"> </td>
</tr>
<tr>
<td height="18" colspan="3" bgcolor="#990100">
<?PHP
if ($documentare !='0'){
echo '
<span class="style1 style3">Documentare</span>
<hr><br>';
};
?> </td>
</tr>
<tr>
<td height="19" bgcolor="#990100">
<?php
echo '<img src="'.$img2src.'">';
?> </td>
<td rowspan="5" bgcolor="#990100"> </td>
<td height="19" valign="top" bgcolor="#990100" class="textdescriere"><span class="bordere3">
<?php
echo $text2;
?>
</span> </td>
</tr>
<tr>
<td height="19" bgcolor="#990100"> </td>
<td height="19" valign="top" bgcolor="#990100" class="textdescriere"> </td>
</tr>
<tr>
<td height="29" bgcolor="#990100"><?php
echo '<img src="'.$img3src.'">';
?></td>
<td height="29" valign="top" bgcolor="#990100" class="textdescriere"><span class="bordere3">
<?php
echo $text3;
?>
</span> </td>
</tr>
<tr>
<td height="19" bgcolor="#990100"><!--DWLayoutEmptyCell--> </td>
<td height="19" valign="top" bgcolor="#990100" class="textdescriere"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="19" bgcolor="#990100">
<?php
echo '<img src="'.$img4src.'">';
?> </td>
<td height="19" valign="top" bgcolor="#990100" class="textdescriere"><span class="bordere3">
<?php
echo $text4;
?>
</span></td>
</tr>
<tr>
<td height="19" colspan="5" valign="top" bgcolor="#990100" class="border"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="4"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
__________________
http://aventuriledox.com < cartile tale preferate http://innovation.lx.ro < Cereri pagini web http://buy.bro.ro < Publica un anunt Last edited by rzv; 29.04.2006 at 20:43:55. |
|
|
|
|
|
#8 |
|
64-Bit member
|
vai....dreamul adauga niste caractere la inceput....acum nu mai am eroarea dar tot nu vad ășț cand import datele din mysql
__________________
http://aventuriledox.com < cartile tale preferate http://innovation.lx.ro < Cereri pagini web http://buy.bro.ro < Publica un anunt |
|
|
|
|
|
#9 |
|
64-Bit member
|
sunt aproape sigur ca problema e la apache, si anume la
default_charset = "iso-8859-1", iso-8859-1 ar trebui modificat cu iso-8859-2 sau utf-8. dar avand in vedere ca nu e vorba de serverul meu sper ca se poate face acest lucru cu .HTACCES Va rog ajutatimasa rezolv problema prin .HTACCES
__________________
http://aventuriledox.com < cartile tale preferate http://innovation.lx.ro < Cereri pagini web http://buy.bro.ro < Publica un anunt |
|
|
|
|
|
#10 |
|
32-Bit Member
|
daca tot nu reusesti cu htaccess propun urmatoarea solutie:
generezi tu niste coduri pt caractere, de ex <~a> sa fie ă si asa mai departe apoi cand afisezi continutul folosesti strreplace("<~a>",chr($cod),$string); poti folosi un array cu toate codurile respectiv caracterele. Nu stiu cat de utila e solutia asta pt tine dar poate te scapa de o gramada de durere de cap. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Moduri de afișare | |
|
|