PDA

View Full Version : تغییر کاراکتر در ارتباط با سرور



momayyezi_m
سه شنبه 31 تیر 1393, 13:31 عصر
با سلام ...برنامه ای در زمینه ارتباط با سرور در حال طراحی هستم .این کد فایل php هست




$sql="select * from dastanha order by ID DESC limit $count ";
$result=mysql_Query($sql);

while($field=mysql_fetch_assoc($result)){

print $field['ID']."|";
print $field['onvan']."|";
$s=str_replace("\n","^",$field['matn']);
print $s."|";
print $field['manbe']."|";
print $field['fav']."|";
print $field['khande']."|"."\n";
}

اینم کدی که تو برنامه گذاشتم


while((line=reader.readLine()) !=null){


int f=0;
int c=0;

for(int i=0;i<line.length();i++){
if(line.charAt(i)=='|'){
String temp=line.substring(f, i);
if(c==0){

tid=temp.toString();
}
if(c==1){

tonvan=temp.toString();
}
if(c==2){


tmatn=temp.replace("^", "\n");


}
if(c==3){



tmanbe=temp.toString();

}
if(c==4){



tfav=temp.toString();

}
if(c==5){



tkhande=temp.toString();

}

f=i+1;
c+=1;
}
}


db.insertContact(tid,tonvan,tmatn,tmanbe,tfav,tkha nde);


ولی وقتی یه متنی که دارای اینتر هست رو تو دیتابیس قرار میدم ،ردیف های ستون جدول برنامم به هم میخوره و متن ها رو نشان نمیدهد..با اینکه تو کد ها گفته بودم که جای اینتر کاراکتر جداگانه ای بذاره

مشکل کجاست؟