我希望它从数据库中获取值并回显网页,但是回显未找到结果。
我的代码:
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.FieldInvariant;
class Parent {
final @Nullable String name;
Parent(@Nullable String name) {
this.name = name;
}
Driver createDriver() {
return new CommonDriver(name);
}
}
@FieldInvariant(qualifier = NonNull.class, field = "name")
class ChildC extends Parent {
ChildC(@NonNull String name) {
super(name);
}
@Override
Driver createDriver() {
return new ChildCDriver(name);
}
}
interface Driver {}
class CommonDriver implements Driver {
CommonDriver(@Nullable String name) {}
}
class ChildCDriver implements Driver {
ChildCDriver(@NonNull String name) {}
}
我的数据库:
also supports @NotNull
答案 0 :(得分:1)
您在过程样式和面向对象样式之间混合使用。
在mysqli_num_rows($result)
上,您正在使用面向对象的类。
在这里$link = mysqli_connect($Host, $UserName, $Password, $DataBaseName);
$query_items = 'SELECT * FROM Products WHERE ID = 6';
$result = $link->query($query_items);
if ($result->num_rows > 0) {
// Fetch one and one row
while ($row = $result->fetch_assoc()) {
echo $row[1];
}
} else {
echo 'No result found';
echo $link->error; // show last error.
}
,您正在使用程序样式进行验证。
尝试使用
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
if launchOptions?[UIApplication.LaunchOptionsKey.location] != nil {
//You have a location when app is in killed/ not running state
locationManager.requestAlwaysAuthorization()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.allowsBackgroundLocationUpdates = true
locationManager.startMonitoringSignificantLocationChanges()
}
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
locationManager.stopUpdatingLocation()
locationManager.startMonitoringSignificantLocationChanges()
locationManager.delegate = self
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let newLocation = locations.last else {
return
}
guard let oldLocation = oldLocation else {
// Save old location
self.oldLocation = newLocation
return
}
let oldCoordinates = oldLocation.coordinate
let newCoordinates = newLocation.coordinate
// Save old location
self.oldLocation = newLocation
currentLocation = newLocation
}
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print("Error \(error)")
if let error = error as? CLError, error.code == .denied {
// Location updates are not authorized.
manager.stopMonitoringSignificantLocationChanges()
return
}
}
编辑:添加了$ link->错误;查看最后一个错误以进行调试。
希望有帮助。
正如Qirel所言,您可以将文档PHP Manual Reference中的面向程序和面向对象混合在一起
混合样式
可以随时在样式之间切换。出于代码清晰和编码样式的原因,建议不要混合使用两种样式。