Jump to content

J450n

Members
  • Content Count

    14
  • Joined

  • Last visited

Everything posted by J450n

  1. Now I see how I can split up the individual columns for the rows and to break them up instead of having a string of the row. Thanks again
  2. @Barand So I get this now. Thank you. It is similar in C#, but I didn't realize I could do this in PHP. Insert other media
  3. I need to learn this. I built the app and those out of bounds errors are not crashing the app or anything. Is it best practice to not worry about those errors because they will resolve themselves anyway? Thank you. getting into it now.
  4. I'm not up to speed enough to tackle Json. I tried to do that route but couldn't get it to work. In that case I wouldn't need a DB, I could just serialize it...but that's out of my comfort zone.
  5. I tried that but seems like a hassle since I'm using the database and it is handling all the data nicely. If I could just connect to the MySQL database straight with out having the app on the server that would be nice but my host doesn't allow it. And with the Json would need to be split up too
  6. The database will be have more than five entries. For testing I want to be able to say if there isn't anything there just say this. But my code above isn't working. The PHP code does echo the two entries just like the other issue I had you helped me with. I understand that I only get one string from the echo and the "/" is splitting them apart so I can display them separately. But because there isn't a third, fourth and fifth I am getting the out of bounds error. Can I echo each individual row in the PHP and get it into the C# with more control other than the "www.downloadhandler.text"?
  7. Is there any other way of getting PHP form data into C# any other way besides calling www.downloadHandler.text I am having issues bringing all the entries into C# and breaking them all up. I can do one row fine but multiple rows isn't working. I keep getting an out range error. This is my PHP echo echo $row['userName']. '|' .$row['level']. '|' .$row['points']. '|' .$row['killRate']. '/'; And this is my C# code string nothing = "Not Placed"; string Data_string = www.downloadHandler.text; string[] DataArray; DataArray = Data_string.Split('/'); int numberOfEntries = DataArray.Length; Debug.Log(numberOfEntries); if (DataArray[0] == null || numberOfEntries == 1) { DataArray[0] = nothing; Debug.Log("Data Array [0] isn't there"); High_Points_1.text = DataArray[0]; } else { High_Points_1.text = DataArray[0]; //Debug.Log(DataArray.Length); } if (DataArray[1] == null || numberOfEntries == 2) { DataArray[1] = nothing; Debug.Log("Data Array [1] isn't there"); High_Points_2.text = DataArray[1]; } else { High_Points_2.text = DataArray[1]; //Debug.Log(DataArray.Length); } if (DataArray[2] == null || numberOfEntries == 3) { DataArray[2] = nothing; Debug.Log("Data Array [2] isn't there"); High_Points_3.text = DataArray[2]; } else { High_Points_3.text = DataArray[2]; } if (DataArray[3] == null || numberOfEntries == 4) { DataArray[3] = nothing; Debug.Log("Data Array [3] isn't there"); High_Points_4.text = DataArray[3]; } else { High_Points_4.text = DataArray[3]; } if (DataArray[4] == null || numberOfEntries == 5) { DataArray[4] = nothing; Debug.Log("Data Array [4] isn't there"); High_Points_5.text = DataArray[4]; } else { High_Points_5.text = DataArray[4]; } I have two entries in the database. But when I debugged the number int he array I get 3 strings. I want to show the top five entries in the database.
  8. Oh I see. Thank you. Now I'll know how to fix that problem when I hit it..lol
  9. Is that to stop the sql injections?
  10. I deleted it as it didn't work. I should have just commented it out but I was pissed. $timeStamp = $_POST["timeStamp"]; $updatequery = "UPDATE userData SET timeStamp= " . $timeStamp. " WHERE GUID = '" . $LoggedIn_guid . "';"; In the database I had that row set to varchar not TimeStamp.
  11. I have a MySQL DB and everything is working perfectly. I wanted to expand it with a time stamp entry. I added all the required code and now cannot update the UPDATE querywhen exiting my app. I deleted all the code associated with the time stamp and everything works as expected. Is there something I do not know about time stamps? I have used it before with C# .net with no issues at all. I'm not a pro PHP guy and have no clue why it would break the UPDATE query.
  12. I changed the echo to this echo $row['GUID'] . '|' . $row['userName']. '|' .$row['health']. '|' .$row['level']. '|' .$row['points']. '|' .$row['killBonus']. '|' .$row['killRate']. '|' .$row['kills']. '|' .$row['misses']; And it works perfectly. I knew there was some formatting of the echo that was screwing me up. Thank you very much for your help.
  13. After posting this I tried this; echo (" ".$row['GUID']. " ".$row['userName']. " ".$row['health']. " ".$row['level']. " ".$row['points']. " ".$row['killBonus']. " ".$row['killRate']. " ".$row['kills']. " ".$row['misses']. ";"); and I got the same result. So do I treat the " " to be an item as well when placing the [number of item] in the C# code?
  14. I am trying to get my database entry's to C# in Unity to display them. This formatting works echo ("|".$row['GUID']. PHP_EOL. "|".$row['userName']. PHP_EOL. "|".$row['health']. PHP_EOL. "|".$row['level']. PHP_EOL. "|".$row['points']. PHP_EOL. "|".$row['killBonus']. PHP_EOL. "|".$row['killRate']. PHP_EOL. "|".$row['kills']. PHP_EOL. "|".$row['misses']. PHP_EOL. ";"); But When I get it into Unity using this code string Data_string = www.downloadHandler.text; string[] DataArray; DataArray = Data_string.Split('|'); //Debug.Log(DataArray); string guid = (DataArray[0]); Debug.Log(guid); string username = (DataArray[1]); Debug.Log(username); int health = System.Convert.ToInt32(DataArray[2]); Debug.Log(health); int level = System.Convert.ToInt32(DataArray[3]); Debug.Log(level); int points = System.Convert.ToInt32(DataArray[4]); Debug.Log(points); int killBonus = System.Convert.ToInt32(DataArray[5]); Debug.Log(killBonus); float killRate = float.Parse(DataArray[6]); Debug.Log(killRate); float kills = float.Parse(DataArray[7]); Debug.Log(kills); float misses = float.Parse(DataArray[8]); Debug.Log(misses); It puts out the first string "GUID" but then throws an error before "username". Can someone help me understand what I am doing wrong? This is the error I am getting. FormatException: Input string was not in a correct format. System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0) System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0) System.Int32.Parse (System.String s, System.IFormatProvider provider) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0) System.Convert.ToInt32 (System.String value) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0) Login+<LoginCalled>d__4.MoveNext () (at Assets/CODE/Login.cs:52) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.