Hi! I tried a few different examples to use a php script to get data from a MySQL database because external access is not allowed. But I could not make it work, yet. Is anyone experienced with PHP/MySQL and can take a look at my code please?
I have a db with a table containing username+serial+hardwareid+blocked and want to check the entered name+serial (maybe hardwaareid) and get the data from the database. Then the app will check if blocked is 0 or 1 to unlock the app.
I tried the video tutorial example with the phonebook (http://www.indigorose.com/products/a...deo-tutorials/) but the php manual says some of the used functions are deprecated. I tried the old code and new code but I always get an "Undefined variable" error.
The Code (commented is old code):
I tried adding " $username = $_POST['username']; $serial = $_POST['serial'];" but this did not help either. (worked in another example. Error messages says undefined index instead of variable)
The Error:
Button Code:
I tried it in the browser with this line:
I have a db with a table containing username+serial+hardwareid+blocked and want to check the entered name+serial (maybe hardwaareid) and get the data from the database. Then the app will check if blocked is 0 or 1 to unlock the app.
I tried the video tutorial example with the phonebook (http://www.indigorose.com/products/a...deo-tutorials/) but the php manual says some of the used functions are deprecated. I tried the old code and new code but I always get an "Undefined variable" error.

The Code (commented is old code):
PHP Code:
<?php
error_reporting(E_ALL);
//connect
//$link = mysql_connect("db516590485.db.1and1.com","dbo516590485","B4SqWaSyX82DB");
//mysql_select_db("db516590485",$link);
// NEUER CODE
// mysqli
$mysqli = new mysqli("host", "user", "pass", "dbname");
$result = $mysqli->query("SELECT * FROM TABLE WHERE Name=".$username." AND Serial=".$serial);
$data = $result->fetch_assoc();
foreach($data as $key => $value) {
$myData .= $value.";;";
}
//if($username != "" && $serial != "") {
// $query = "SELECT * FROM CWLP WHERE Name=".$username." AND Serial=".$serial;
// $result = mysql_query($query,$link);
// while($data = mysql_fetch_assoc($result)) {
// foreach($data as $key => $value) {
// $myData .= $value.";;";
//}
//}
echo $myData;
//}
?>
The Error:
Code:
Notice: Undefined variable: username in /homepages/29/xxx/htdocs/sites/b/apps/cwlp/checkserial.php on line 11 Notice: Undefined variable: serial in /homepages/29/xxx/htdocs/sites/b/apps/cwlp/checkserial.php on line 11 Fatal error: Call to a member function fetch_assoc() on a non-object in /homepages/29/xxx/htdocs/sites/b/apps/cwlp/checkserial.php on line 12
Code:
httpresult = HTTP.Submit("http://www.playbird.at/sites/b/apps/cwlp/checkserial.php", {username="test", serial="testserial"}, SUBMITWEB_GET, 20, 80, nil, nil);
Comment