Shop-Script и знаки вопроса при импорте базы MySQL

17.06.2009, рубрики: Мелочи | Теги: , , , | 13 373 комментария »

На днях позвонил человек, попросил помочь с кодировкой сайта. Сайт сделан на Shop-Script (интернет магазин). Ситуация такова, сайт хостился у одного хостинг-провайдера, теперь на другом. Был создан дамп базы данных MySQL и импортиран с той же кодировкой сравнения. Итог: вместо латинских букв, знаки вопроса. Игры с кодировками при экспорте базы и импорте успехов не принесли. Оставалось последнее действие, я был полон надежды, что оно поможет. И так, начнем.

В файле: /includes/database/mysql.php находим блок:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function db_query($s) //database query
{
$res = array();
$res["resource"] = mysql_query($s) or die( db_error()." SQL query : ".$s);
$select_keyword_index    = strpos(strtoupper($s), "SELECT");
$from_keyword_index        = strpos(strtoupper($s), "FROM");
$columns=substr( $s, $select_keyword_index + strlen("SELECT"),
$from_keyword_index - 1 - ( $select_keyword_index + strlen("SELECT") ) + 1 );
$res["columns"]=array();
$column_index = 0;
$columnArray = explode(",", $columns);
foreach($columnArray as $value)
{
if ($asIndex = strpos(strtoupper($value), "AS "))
$columnName=trim(substr($value, $asIndex+2));
else
$columnName=trim($value);
$res["columns"][$columnName] = $column_index;
$column_index++;
}
return $res;
}
[/sourcecode]

И приводим его к такому виду:

[sourcecode language='php']
function db_query($s) //database query
{
$res = array();
$res["resource"] = mysql_query($s) or die( db_error()." SQL query : ".$s);
mysql_query("SET character_set_client=cp1251");
mysql_query("SET character_set_connection=cp1251");
mysql_query("SET character_set_results=cp1251");
$select_keyword_index    = strpos(strtoupper($s), "SELECT");
$from_keyword_index        = strpos(strtoupper($s), "FROM");
$columns=substr( $s, $select_keyword_index + strlen("SELECT"),
$from_keyword_index - 1 - ( $select_keyword_index + strlen("SELECT") ) + 1 );
$res["columns"]=array();
$column_index = 0;
$columnArray = explode(",", $columns);
foreach($columnArray as $value)
{
if ($asIndex = strpos(strtoupper($value), "AS "))
$columnName=trim(substr($value, $asIndex+2));
else
$columnName=trim($value);
$res["columns"][$columnName] = $column_index;
$column_index++;
}
return $res;
}

Ура, получилось. Знаки вопросов пропали, буквы отображаются как нужно.


13 373 комментария на запись “Shop-Script и знаки вопроса при импорте базы MySQL”

  1. 1 EvaHycle сказала в 1:57, 18.03.2021:

    viagra usa prescription

  2. 2 WanceLeawsdape сказала в 3:00, 18.03.2021:

    good credit score range free credit credit score check my credit score credit karma

  3. 3 JaneHycle сказала в 4:19, 18.03.2021:

    cheap kamagra uk

  4. 4 Random Assignments сказала в 6:08, 18.03.2021:

    examination essay writing

  5. 5 spearmaoveria сказала в 6:09, 18.03.2021:

    freecreditscore creditreportgetstats.com — credit score chart boost credit score free annual credit report official site

  6. 6 equaBly сказала в 6:29, 18.03.2021:

    vsdoxycyclinev.com — buy cheap doxycycline

  7. 7 WanceLeawsdape сказала в 6:38, 18.03.2021:

    best credit score how to read credit report annual credit score free business credit report

  8. 8 adotaccuthfaf сказала в 7:13, 18.03.2021:

    free credit report government creditreportuss.com — unfreeze credit report how to increase credit score myfreecreditreport

  9. 9 spearmaoveria сказала в 7:31, 18.03.2021:

    military payday loan paydayadvancetwin.com — payday loans near me defaulted payday loan mypaydayloan relief

  10. 10 WanceLeawsdape сказала в 9:15, 18.03.2021:

    check credit rating highest credit score possible credit score definition credit score check free

  11. 11 adotaccuthfaf сказала в 11:12, 18.03.2021:

    payday loan services payday loan fast payday loan online instantly online loans

  12. 12 beiplyabalse сказала в 11:18, 18.03.2021:

    free credit score online credit report freecreditreportww.com — credit score chart view my credit report truly free credit scores

  13. 13 karthik сказала в 11:21, 18.03.2021:

    The digital workplace is a central working environment that employees can access from anywhere and at any time – whether they’re on the train, in their home office or at the beach. AMAZING POSTAll data is stored in one location and can be accessed quickly and easily. Your employees are freer to determine when and how they work and therefore more efficient. Discover the digital workplace for your company.

  14. 14 KimHycle сказала в 11:21, 18.03.2021:

    dexamethasone 1.5 mg

  15. 15 Situs Togel сказала в 13:50, 18.03.2021:

    Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write

    ups thanks once again.

  16. 16 WanceLeawsdape сказала в 14:36, 18.03.2021:

    fast payday loan paydayadvancetwin.com — payday loan lenders online guaranteed payday loan emergency payday loans

  17. 17 equaBly сказала в 16:07, 18.03.2021:

    hcialischeapc.com — viagra and cialis online

  18. 18 KimHycle сказала в 18:29, 18.03.2021:

    where to buy female viagra us

  19. 19 JaneHycle сказала в 19:37, 18.03.2021:

    flomax 0.4 mg tablet

  20. 20 spearmaoveria сказала в 21:04, 18.03.2021:

    credit reporting agency free equifax credit report request how to raise your credit score fast freecreditscore

  21. 21 beiplyabalse сказала в 21:26, 18.03.2021:

    how to get credit report creditreportadvanced.com — free credit score how to check my credit score get free credit score

  22. 22 Roberthiero сказала в 22:28, 18.03.2021:

    «Nice post. I learn something totally new and challenging on sites I stumbleupon on a daily basis. It will always be helpful to read articles from other writers and use a little something from other websites.»

    דירות דיסקרטיות בחיפה

  23. 23 EvaHycle сказала в 4:46, 19.03.2021:

    buy viagra online

  24. 24 spearmaoveria сказала в 5:51, 19.03.2021:

    online credit score credit check what is a good credit score number what is a good credit score number

  25. 25 beiplyabalse сказала в 6:25, 19.03.2021:

    check credit score for free creditscorecheckresults.com — credit score calculator trans union corporation free credit report mint credit score

  26. 26 adotaccuthfaf сказала в 6:43, 19.03.2021:

    ace payday loan payday loan online instantly payday loans payday loan online

  27. 27 WanceLeawsdape сказала в 8:08, 19.03.2021:

    free credit report instant free credit report uk experian credit report free

  28. 28 WanceLeawsdape сказала в 9:10, 19.03.2021:

    unfreeze credit report credit report companies credit score online credit score calculator

  29. 29 spearmaoveria сказала в 11:45, 19.03.2021:

    how do i check my credit score free credit score report how to get free credit report transunion credit report phone number

  30. 30 adotaccuthfaf сказала в 12:21, 19.03.2021:

    get credit report — free credit report fastcheckcreditscores.com — online credit report experian credit get free credit report

  31. 31 spearmaoveria сказала в 14:17, 19.03.2021:

    credit karma com free credit score freecreditscoreses.com — credit score scale free credit report government free credit scores

  32. 32 ionipsy сказала в 14:54, 19.03.2021:

    ponlinecialisk.com — buy cialis cheap

  33. 33 beiplyabalse сказала в 15:59, 19.03.2021:

    intuit credit score how to check my credit score annualcreditreport how to get a free credit report

  34. 34 KegoKibStodeneK сказала в 17:28, 19.03.2021:

    credit scoring national credit report credit report monitor

  35. 35 spearmaoveria сказала в 18:14, 19.03.2021:

    experian business credit report credit karma credit report free annual credit report complaints

  36. 36 beiplyabalse сказала в 18:32, 19.03.2021:

    instant cash payday loan paydaylendersww.com — military payday loan payday loan services cash advance

  37. 37 spearmaoveria сказала в 18:32, 19.03.2021:

    payday loan fast payday loan laws california easy payday loans online online payday

  38. 38 Caydetora сказала в 18:56, 19.03.2021:

    пергидроль для бассейна

  39. 39 spearmaoveria сказала в 21:26, 19.03.2021:

    what is my credit score free credit report gov credit score range

  40. 40 GaoBreeldVen сказала в 0:46, 20.03.2021:

    cialis or kamagra reviews

  41. 41 EvaHycle сказала в 2:54, 20.03.2021:

    best prices for viagra in canada

  42. 42 WanceLeawsdape сказала в 6:30, 20.03.2021:

    what is my credit score creditreportsps.com — credit reporting agency how to improve your credit score free credit score free credit reports

  43. 43 AMN082 сказала в 8:18, 20.03.2021:

    Wonderful goods from you, man. I have understand your stuff previous to and you're just extremely great.

    I really like what you've acquired here, certainly like what you're saying and the way

    in which you say it. You make it entertaining and you still take care of

    to keep it wise. I can not wait to read far more from you.

    This is really a tremendous website.

  44. 44 JaneHycle сказала в 9:16, 20.03.2021:

    buy zentiva hydroxychloroquine

  45. 45 WanceLeawsdape сказала в 9:39, 20.03.2021:

    credit karma credit score free free credit report gov free credit credit score

  46. 46 spearmaoveria сказала в 9:57, 20.03.2021:

    free annual credit report free credit karma uk free annual credit report free what is good credit score

  47. 47 beiplyabalse сказала в 10:51, 20.03.2021:

    turbo credit score free experian credit report how to ck your credit score

  48. 48 AAAAAgmailcom сказала в 12:38, 20.03.2021:

    rjpqfbuuyyoonea

    wondernotenvy.wordpress.c...nonce=6dd013882a

    demo.ngofficiel.fr/viewto...?p=127334#127334

    enisan.com.tr/forum/viewt...f=7&t=124542

    slapinsky.com/nature/the- ...bd#comment-88884

    137.59.150.54/forum.php?m...62207&extra=

    redclayyoga.org/contact/?..nonce=6098cf975f

    prozon.org.pl/forum/viewt...pid=52643#p52643

    tomhuff.wordpress.com/abo...nonce=8cf996c00e

    gimpel.ru/reviews#comment-152722

    kafferecept.se/recipe/cha...c#comment-760396

    everaldcompton.com/?conta...nonce=9c0b603148

    diplomrus.ru/raboti/100361?new

    avs.admindemos.com/blog/38453

    www.newstepsystems.com/ve...9f#comment-20355

    forum.btcpbrand.com/viewt...f=4&t=896435

    tomhuff.wordpress.com/abo...nonce=1c3382aafb

    mybusinessconsultants.wor...nonce=cdb754ea39

    www.djangoboards.com/boards/1/topics/136618/

    drchdietfood.com/contact- ...nonce=61abee1aef

    cardingmagazine.com/showt...318460#pid318460

    tomhuff.wordpress.com/abo...nonce=f3d8cbbd19

    www.successdigestforum.co...=6&t=1499848

    amygibbs.co.uk/print-quot...nonce=69ee48134e

    rooftoppros.wordpress.com...nonce=45ec85e4e6

    michaelmcgrinder.com/?con...nonce=45449339e9

    pa2010.cdms.westernsydney...f=29&t=19331

    palais.beesims.com/phpbb/...?f=4&t=47492

    ebayhots.info/viewtopic.php?f=2&t=84765

    www.rickbouthoornracing.c...7550—2021#677134

    www.aqueousmeditation.com...?f=4&t=43146

    gopinball.com/forum/viewt...f=6&t=246414

    protee.guru/viewtopic.php?f=8&t=1241667

    forum.nebula-galaxia.de/v...f=2&t=169066

    forum.moroe.eu/viewtopic.php?f=4&t=44674

    bitexpert.club/viewtopic.php?f=5&t=193712

    forum.viewcomiconline.com...ead.php?tid=4342

    ukrmarket.in.ua/eng/forum/aalboype96480/

    pa2010.cdms.westernsydney...f=29&t=19324

    www.adimpiantielettrici.i...Itemid=124#68033

    igrok-forum.ru/viewtopic.php?f=2&t=49056

    spinbotstudio.fr/forum/vi...f=8&t=494109

    mywork2.ru/speak/viewtopi...f=2&t=145604

    adminclub.org/Thread-%D0%...B2%D0%B5--289211

    ffexodus.com/clanforums/v...?f=3&t=71786

    oleksy-bau.de/index.php/f...7289—2021#736950

    gamezombie.co.uk/mybb/sho...d.php?tid=112676

    fourm.erw.app/viewtopic.php?f=4&t=88523

    nadiawashere.com/forum/vi...f=5&t=124106

    intersavegame.co.uk/phpBB...=3&t=1624019

    palais.beesims.com/phpbb/...?f=4&t=47494

    www.rickbouthoornracing.c...7565—2021#677149

    kamdanlife.network/forums...%B0%D0%B9%D0%BD/

    www.wasasando.com/viewtop...f=31&t=35938

    forum.1one.blue/viewtopic...f=20&t=98401

    forum.1one.blue/viewtopic...f=20&t=98403

    forum.1one.blue/viewtopic...f=20&t=98384

    shortcels.co/index.php?/t...%82%D0%B2%D0%B5/

    www.aqueousmeditation.com...?f=4&t=43133

    vilia.it/index.php/forum/...47134-2021#47134

    ebayhots.info/viewtopic.php?f=2&t=84777

    apisphera.ru/forum/vopros...oroshem-kache-6/

    ffexodus.com/clanforums/v...?f=3&t=71788

    rcpbmn.com/phpBB2/viewtop...7a5ff474ac5be822

    www.unraveled.net/phpbb/v...=6&t=1703328

    protee.guru/viewtopic.php?f=8&t=1241644

    protee.guru/viewtopic.php?f=8&t=1241688

    xn--n1abdbeg.xn--p1ai/for...365.html#p132365

    protee.guru/viewtopic.php?f=8&t=1241694

    xn--l1adgmc.xn--80aaeowim...p=118794#p118794

    ionelnistor.com/forum/vie...f=4&t=239184

    Ваш комментарий ожидает проверки модератора.

  49. 49 Jasondom сказала в 13:15, 20.03.2021:

    как купить на гидре

    зайти на гидру

  50. 50 KegoKibStodeneK сказала в 13:39, 20.03.2021:

    my free credit score what is considered a good credit score myfreecreditreport


Оставить комментарий


  • четыре + = двенадать