I have a C# program that runs WebClient to bind data from MySQL database. When my query arrives, the server drops the notice:
Trying to get property of non-object on line 46.
Here is my PHP code:
<? //Some $Conn details thing in the beginning.
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "". $row["id"] . "|" . $row["nev"] . "|" . $row["_1"] . "|" . $row["_2"] . "|" . $row["_3"] . "|" . $row["_4"] . "|" . $row["_5"] . "|" . $row["_6"] . "|" . $row["_7"] . "|" . $row["_8"] . "|" . $row["_9"] . "|" . $row["_10"] . "|" . $row["_11"] . "|" . $row["_12"] . "|" . $row["_13"] . "|" . $row["_14"] . "|" . $row["_15"] . "|" . $row["_16"] . "|" . $row["_17"] . "|" . $row["_18"] . "|" . $row["_19"] . "|" . $row["_20"] . "|" . $row["_21"] . "|" . $row["_22"] . "|" . $row["_23"] . "|" . $row["_24"] . "|" . $row["_25"] . "|" . $row["_26"] . "|" .$row["_27"] . "|" . $row["_28"] . "|" . $row["_29"] . "|" . $row["_30"] . "|" . $row["_31"] . "<br>" ;
}
}
else {
echo "No result.";
}
$conn->close();
?>
And the query posted by the program:
private void retrieve(int y, string date) {
string sql = "SELECT * FROM z_fdbeo_"+date+"";
loader.loaddata(sql, "fill_fdbeo31", 15);
}
Where date
is a string that came from a listBox
item.
Just one thing: all of my PHPs are the same, I just changed the echo
part...
Any ideas?