1

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?

Badacadabra
  • 8,043
  • 7
  • 28
  • 49
  • 2
    What is on line 46? – shaggy May 20 '17 at 18:14
  • First of all, what's the point in adding an empty state after the date? Won't make an issue, just can't get the point tho. Secondly, are you sure your php recieves the sql string correctly? Did you try printing it out? If so, might be the problem that you are trying to get a column with a non-existing column name. (For example `$row["nev"]` might be `'name'` in your table etc.) p.s. Hungary? :D – Hienz May 20 '17 at 18:19
  • Hey. First of all yes, from Hungary. :) The others: the sipmle empty quote is the remains of the query before. I was just lazy to delete it. I'd printed out, but the pushing is OK. All the columns are existing (an other event is making the database with a counting-for loop depends how many days are in the current month. Therefore these are the same. The 46th line is the row binding exactly in the while loop. – András Juhász May 20 '17 at 18:25

0 Answers0