Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Viewing Database Error
Old 05-21-2008, 08:20 PM Viewing Database Error
Extreme Talker

Posts: 189
Trades: 0
php code
PHP Code:
    $sortby 'name';
    
$set 'y';
 
$number 0;

$fp fopen('data.txt','r');
if (!
$fp) {echo 'ERROR: Unable to open file.'; exit;}



while (!
feof($fp)) {
    
$line fgets($fp,1024); //use 2048 if very long lines
    
$row++;
 list (
$url$name$type$img) = split ('\|'$line);
    if (
$sortby == 'name'$sortkey strtolower($name);
    
$col[$row] = array($sortkey$name$type$url$img);
}

fclose($fp);

sort($col);
reset ($col);

$arrays count($col) - 1;

$loop = -1;
while (
$loop $arrays) {
    
$loop++;


       if (
$col[$loop][2] == "$group") {
              
$number++;
      

echo 
'
<td class="td2" valign="top"><div align="center"><a href="http://apps.facebook.com/fluff/fluffbook.php?id='
.$col[$loop][3].'">'.$col[$loop][1].'<br><img src="pets/'.$col[$loop][4].'.png" width="110" class="'.$number.'"></a></div></td>
'
;
   if((
$number 4)==0)
   {
    echo 
"</tr>";
    echo 
"<tr>";
   }
}} 
In some of the names in the data file they have special charactors like




but when my code reads in the database it shows them as
♥
☆
è›™

how can I fix this?

Last edited by simster; 05-21-2008 at 08:22 PM..
simster is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-21-2008, 11:13 PM Re: Viewing Database Error
Extreme Talker

Posts: 189
Trades: 0
anyone?
simster is offline
Reply With Quote
View Public Profile
 
Old 05-22-2008, 05:30 AM Re: Viewing Database Error
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Probably you should set the correct character set header while sending the page to a browser, and the charset should be equal to the one of those strange characters, most likely UTF-8.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to Viewing Database Error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
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 On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15611 seconds with 12 queries