jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Both functions return integers! <?php $str_en = "Happy Birdday"; $str_ch = '祝你生日快樂'; var_dump(mb_strlen($str_ch,'utf8')); // int(6) var_dump(str_word_count($str_en)); // int(2) echo mb_strlen($str_ch,'utf8') + str_word_count($str_en); // 8
-
Then count (gather) the result of Chinese and EN words and display the output!
-
It's normal for gurus over 40 Take example kids
-
So, if I understand you correctly there is no letters in Chinese language, right? Have you ever checked these multibyte string functions? You can apply a rule if the string contains itself EN characters use str_word_count() if they are Chinese use mb_strlen(). <?php $str_en = "Happy Birdday"; $str_ch = '祝你生日快樂'; echo mb_strlen($str_c,'utf8'); // 6 Chinese words (characters) echo str_word_count($str_e); // two EN words
-
Yep, that's a good idea. Mail theme For less cpu and memory usage I'm not sure, since I checked the link provided by mac_gyver, but for speed and performance it would be possible.
- 10 replies
-
@Pradeep_Chinna, next time try to give a meaningful topic title to your problematic thread, not just "del"! Do you know that this text editor supports BBcode tags itself? Use them like @Ch0cu3r, please!
-
Are you sure, that this string "祝你生日快樂" contains itself 6 words? Is there letters in this language like in European languages? Instead using PCRE (Perl Compatible Regular Expressions) you have to consider using multibyte character encoding schemes and some multibyte string functions in php. Have a look this example: $str = "祝你生日快樂"; echo strlen($str); // 18 echo '<br />'; echo mb_strlen($str, 'utf8'); // 6 What's wrong and right you should tell us
-
Yea, it's possible! Check out their docs.
- 10 replies
-
How Can I Display Categories and Articles in Alphabetical Order?
jazzman1 replied to Fluoresce's topic in PHP Coding Help
You can use ORDER BY on different keys in MySQL: SELECT * FROM t1 ORDER BY key1, key2; Or, just mix them: SELECT * FROM t1 ORDER BY key_part1 DESC, key_part2 ASC; Check this out.- 4 replies
-
- alphabetical order
- mysql select
-
(and 1 more)
Tagged with:
-
Your code doesn't have error checking logic in it. Turn on the error_reporting functions on the top of this file! Also, you can show us the HTML form.
-
What charset encoding are you using to get the binary sting from your DB or something else, for example? Make sure that this binary data is saved into a file under UTF-8 encoding charset without BOM, then try again I thing that's your problem. You can post out this problematic string here for testing purposes if you want it.
- 10 replies
-
I don't use phpMailer, but it sounds like you never sent anybody a message with a gmail account. Have you ever tried some debugging steps to debug the output of this $to variable? Something like: $to = implode(", ", $addresses); echo '<pre>'.print_r($to, true).'</pre>'; Also, what happens if you try to set two or more outgoing messages to different mail servers in the AddAddress() method? $mail->AddAddress("userName@outlook.com","userName@gmail.com");
-
In addition to what mac said, you need to combine these two sql queries into one query.
-
Getting Informix PDO to work in CentOS 6
jazzman1 replied to OldCrow's topic in PHP Installation and Configuration
He-he...good job You have to know, that SELinux doesn't allow the httpd daemon to "talk" to the LDAP server on the CentOS(RedHat) machines. So, you should care about that very well. Otherwise, a lot of php functions won't work, like mkdir(), mail(), copy(), move_uploaded_file() and so on! -
Getting Informix PDO to work in CentOS 6
jazzman1 replied to OldCrow's topic in PHP Installation and Configuration
What's my suggestion to you, if mac's suggest doesn't work is to download a pdo_informix driver and place it to php.x.version/ext directory. Then, just compile that version of php from source code. Check for available options: cp -R PDO_INFORMIX-1.3.0/* path_to_php_library/ext/pdo_informix ./configure --help ./configure --with-pdo-informix=/DIR // it's a directory of this database pdo_informix -
Make sure that your dump data is saved into a file with utf8 encoding without BOM! Then, try to run next (assuming the default port is 3306): mysql --host=DBHOST --user=DBUSER --password=DBPASS --default-character-set=UTF8 --port=3306 < path_to__/dump.sql Or, import this 'dump.sql' file into an existing database, for instance: mysql --host=DBHOST --user=DBUSER --password=DBPASS --default-character-set=UTF8 --port=3306 --database=DUMB_DB < path_to__/dump.sql
-
Problem with picture upload after upgrading PHP to ver.5.3.27
jazzman1 replied to Tomislav's topic in PHP Coding Help
Ah....I see that now So, try that: <?php // set the path to img directory $path = $_SERVER['DOCUMENT_ROOT'] . '/images/content/'; if (is_uploaded_file($_FILES['uploaded_file']['tmp_name'])) { $brojac = 1; while (file_exists($path . $brojac . '.jpg')) $brojac = $brojac + 1; $slika = $brojac; $filesaved = copy($_FILES['slika']['tmp_name'], $path . 'o_' . $slika . '.jpg'); // set original image location $img = $path . 'o_' . $slika . '.jpg'; // set our image canvas $canvas_width = 150; $canvas_height = 500; // get width and height of original image list($img_width, $img_height) = getimagesize($img); $ratio_orig = $img_width / $img_height; if ($canvas_width / $canvas_height > $ratio_orig) { $canvas_width = $canvas_height * $ratio_orig; } else { $canvas_height = $canvas_width / $ratio_orig; } // loading in our original image $original = imagecreatefromjpeg($img); // create a blank canvas $canvas = imagecreatetruecolor($canvas_width, $canvas_height); imagecopyresampled($canvas, $original, 0, 0, 0, 0, $canvas_width, $canvas_height, $img_width, $img_height); if (imagejpeg($canvas, $img, 100)) { return true; } else { return false; } -
It's a little ugly, but it could help you what the function is. function OutputData($sql) { $outputs = ''; $result = $conn->query($sql); $outputs .= "<html><body><select name='id'>"; while ($row = $result->fetch_assoc()) { unset($id, $name); $id = $row['id']; $name = $row['bedrijfsnaam']; $outputs .= '<option value="'.$id.'">'.$name.'</option>'; } $outputs .="</select></body></html>"; return $outputs; }
-
@jk1112, does your html form have an enctype attribute itself?