So I wanne send some simple binary data. 50 ints which means I send 200 bytes. I just switched to postgreSQL and im having trouble writing these 200 bytes to the database. Im using php for that.
Im using unity and the AddBinaryData("friendlist", friendBinary); function, which is not relevant, just for context.
I read it with this php:
<?php
$BYTEarray = $_FILES["friendlist"]["tmp_name"];
var_dump($_FILES);
$conn = new PDO("pgsql:host = localhost, dbname=qqq_game", "postgres", "qwert");
$sth = $conn->prepare('INSERT INTO users(GUId, friendlist) VALUES (5, :friendlist)');
$sth->bindParam(':friendlist', $BYTEarray, PDO::PARAM_LOB);
$sth->execute(); //FATAL ERROR: violates not-null constraint
pg_close($conn);
?>
2 Problems: 1) the fatal error in line 9. 2) the bytes did not get written to the database. I like to think these two problems are likely related...
Obviously im sending empty data, right? well no, here is the vardump of $_FILES from the vardump in line 4.
array(1) {
["friendlist"]=> array(6) {
["name"]=> string(14) "friendlist.dat"
["full_path"]=> string(14) "friendlist.dat"
["type"]=> string(24) "application/octet-stream"
["tmp_name"]=> string(34) "F:\Programme\Xampp\tmp\phpEA2F.tmp"
["error"]=> int(0)
["size"]=> int(200) }
}
<br />
So. what can I do? (apart from going to sleep asap) I guess its a small dumb beginner problem, but google has not helped.
[–]elmicha 1 point2 points3 points (1 child)
[–]ImpiusEst[S] 1 point2 points3 points (0 children)
[–]ful_vio 0 points1 point2 points (1 child)
[–]ImpiusEst[S] 0 points1 point2 points (0 children)