Jump to content
php.lv forumi

MySql dati un PHP substr


cipcaps

Recommended Posts

Lieta tāda ka ņemos jau kādu laiku ar to un nekas neiet.

Datubāzē ir lauks ar tekstu "Kāda mūsu fane", caur phpMyAdmin izskatās šādi "KÄda mÅ«su fane"

Bet kad lietoju šādu kodu

$res = mysql_query("SELECT * FROM `table` WHERE `id` = 'info' ORDER BY `id` DESC");
while($arr = mysql_fetch_array($res)){
   echo $arr['text'];
}

 

tiek parādīts skaisti "Kāda mūsu fane", bet ja vajag piem. nosaukumu kas ierobežo garumu, šādi

$res = mysql_query("SELECT * FROM `table` WHERE `id` = 'info' ORDER BY `id` DESC");
while($arr = mysql_fetch_array($res)){
   echo substr($arr['text'],0,7);
}

tad ir tā "Kāda m", jo cik saprotu tad viņš lieto "KÄda mÅ", bet kā lai dabūt to ka viņš "Å«" uzskata par "ū" pirms paņem pirmos septiņus simbolus?

 

PALDIES.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...