Phorum.ro
Your Avatar Welcome to Phorum.ro!
If you haven't registered yet, click here!
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.
Du-te înapoi   Phorum.ro > Web Design & Web Development > Programare > PHP > PHP DB

PHP DB Discutii despre lucrul cu baze de date in PHP.

Răspunde
 
Thread Tools Moduri de afișare
Vechi 29.04.2006   #1
rzv
64-Bit member
 
Data înregistrării: 20.07.2005
Vârsta: 21
Mesaje: 222
Rep Power: 7
rzv is on a distinguished road
Trimite un mesaj prin Yahoo pentru rzv
Implicit MySqlI

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">
dar din pacate tot nu merge. In mysql am gestionarea utf-8-romanian_ci dar tot degeaba si de aceea incerc cu unctia din documentatia php
__________________
http://aventuriledox.com < cartile tale preferate

http://innovation.lx.ro < Cereri pagini web

http://buy.bro.ro < Publica un anunt
rzv is offline   Reply With Quote
Sponsored Links
Vechi 29.04.2006   #2
Osgiliath
64-Bit member
 
Data înregistrării: 21.03.2006
Mesaje: 209
Rep Power: 0
Osgiliath is on a distinguished road
Implicit

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.
Osgiliath is offline   Reply With Quote
Vechi 29.04.2006   #3
rzv
64-Bit member
 
Data înregistrării: 20.07.2005
Vârsta: 21
Mesaje: 222
Rep Power: 7
rzv is on a distinguished road
Trimite un mesaj prin Yahoo pentru rzv
Implicit

daca bag codul pentru header :
Cod:
<?php
header("Content-Type: text/html;charset=utf-8");
?>
in fisierul carti.php chiar si inainte de includerea fisierului care face conectarea la baza de date, tot nu merge. 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 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
rzv is offline   Reply With Quote
Vechi 29.04.2006   #4
Osgiliath
64-Bit member
 
Data înregistrării: 21.03.2006
Mesaje: 209
Rep Power: 0
Osgiliath is on a distinguished road
Implicit

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.
Osgiliath is offline   Reply With Quote
Vechi 29.04.2006   #5
rzv
64-Bit member
 
Data înregistrării: 20.07.2005
Vârsta: 21
Mesaje: 222
Rep Power: 7
rzv is on a distinguished road
Trimite un mesaj prin Yahoo pentru rzv
Implicit

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
In caz ca cineva observa unde este problemail rog frumos sa ma ajute
__________________
http://aventuriledox.com < cartile tale preferate

http://innovation.lx.ro < Cereri pagini web

http://buy.bro.ro < Publica un anunt
rzv is offline   Reply With Quote
Vechi 29.04.2006   #6
Osgiliath
64-Bit member
 
Data înregistrării: 21.03.2006
Mesaje: 209
Rep Power: 0
Osgiliath is on a distinguished road
Implicit

Fisierul carti.php il incluzi in alt fisier cumva?
Osgiliath is offline   Reply With Quote
Vechi 29.04.2006   #7
rzv
64-Bit member
 
Data înregistrării: 20.07.2005
Vârsta: 21
Mesaje: 222
Rep Power: 7
rzv is on a distinguished road
Trimite un mesaj prin Yahoo pentru rzv
Implicit

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-->&nbsp;</td>
  </tr>
  
  <tr>
    <td height="25" colspan="5" valign="top" class="bordersus"><!--DWLayoutEmptyCell-->&nbsp;</td>
  </tr>
  <tr>
    <td width="34" rowspan="11" align="center" valign="middle" bgcolor="#990100"><!--DWLayoutEmptyCell-->&nbsp;</td>
  <td height="19" colspan="3" valign="top" bgcolor="#990100"><!--DWLayoutEmptyCell-->&nbsp;</td>
  <td width="33" rowspan="11" valign="top" bgcolor="#990100"><!--DWLayoutEmptyCell-->&nbsp;</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-->&nbsp;</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">&nbsp;</td>
    <td height="19" valign="top" bgcolor="#990100" class="textdescriere">&nbsp;</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">&nbsp;   </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">&nbsp; </td>
    <td height="19" valign="top" bgcolor="#990100" class="textdescriere">&nbsp; </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-->&nbsp;</td>
    <td height="19" valign="top" bgcolor="#990100" class="textdescriere"><!--DWLayoutEmptyCell-->&nbsp;</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-->&nbsp;</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.
rzv is offline   Reply With Quote
Vechi 29.04.2006   #8
rzv
64-Bit member
 
Data înregistrării: 20.07.2005
Vârsta: 21
Mesaje: 222
Rep Power: 7
rzv is on a distinguished road
Trimite un mesaj prin Yahoo pentru rzv
Implicit

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
rzv is offline   Reply With Quote
Vechi 29.04.2006   #9
rzv
64-Bit member
 
Data înregistrării: 20.07.2005
Vârsta: 21
Mesaje: 222
Rep Power: 7
rzv is on a distinguished road
Trimite un mesaj prin Yahoo pentru rzv
Implicit

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
rzv is offline   Reply With Quote
Vechi 15.05.2006   #10
danny
32-Bit Member
 
Data înregistrării: 23.11.2005
Vârsta: 24
Mesaje: 88
Rep Power: 7
danny is on a distinguished road
Trimite un mesaj prin Yahoo pentru danny
Implicit

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.
danny is offline   Reply With Quote
Răspunde


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Moduri de afișare

Reguli de postare
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 Pornit
emoticoanele sunt Pornit
Codul [IMG] este Pornit
Codul HTML este Oprit



Ora este GMT +3. Ora este acum 11:37:24.


Rulează cu: vBulletin Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Forum SEO by Zoints

XXXXXXXXXXXXXXXXXXX
Inactive Reminders By Icora Web Design