This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
1
Can't get individual properties from passed array
Post Flair (click to view more posts with a particular flair)
Post Body
So I am trying to do this in javascript:
let testAgain = [{
"test": JSON.stringify(otherArray),
"a" : 'test'
}];
req.send(JSON.stringify(testAgain));
and then I am trying:
<?php
$servername = "oatney.cauldron.dreamhost.com";
$username = "Me";
$password = "MyPassword";
$dbname = "MyDb";
$conn = new mysqli($servername, $username, $password, $dbname); // Create connection
if ($conn->connect_error) { // Check connection
die("Connection failed: " . $conn->connect_error);
}
$data = mysqli_real_escape_string($conn,file_get_contents('php://input'));
$bob = json_decode(file_get_contents('php://input'), true);//$_POST['test'];
echo "DERP: " . (file_get_contents('php://input')->$a) . "DERP: " . (file_get_contents('php://input')->$test) . " || Test: " . ($bob->$test) . " || Test: " . $bob['a'] ;
$sql = "INSERT INTO `niohTwo_cb` (`buildInfo`) VALUES ('$bob')";
if ($conn->query($sql) === TRUE) {
$last_id = $conn->insert_id;
echo $last_id;
} else {
//echo "Error: " . $sql . "<br>" . $conn->error;
}
?>
but for some reason I can't get property "a" or property "test" to appear..
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PHPhelp/com...