Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Why FormatException: Input string was not in the correct format?

$
0
0
String looks like 8. But I cant convert it to number. Code: public void UpdCoins(string str) { Write ("strCoins="+str+" uid="+UserId+" next ch "); Write ("="+str+"=");// returns =8= Write (("8"==str[0].ToString()).ToString());// returns False // declare a string variable with a value that represents a valid integer string sillyMeme = str; int memeValue; // attempt to parse the value using the TryParse functionality of the integer type int.TryParse(sillyMeme, out memeValue); Write(memeValue.ToString());//9001 SocialData[UserId].Coins = memeValue; Write ("RESULT Coins="+SocialData[UserId].Coins.ToString()+" uid="+UserId); } public static void Write(string mes) { Application.ExternalCall ("Alert", mes); //LogClass.Mess += mes + " "; Debug.Log ("SM->" + mes); } This pieces are in SocialManager.cs Now piece from index.html of game function GetCoins() { alert(viewer_id + "do"); SendToPlayer("UpdCoins", ''); } function SendToPlayer(func, what){ gameInstance.SendMessage("SocialManager",func,what); } And now the full php prepare('SELECT * FROM payments WHERE users="372380032"'); $stmt->execute(); $data = $stmt->fetchAll(); $result = $data[0]['coins']; $pdo = null; echo $result.''; ?> Why "8" cant convert to 8? Returns format error

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>