我正在尝试添加多个停靠点(停止包含变量(“站点停止”和“int numberLiters”)到具有此循环的路径及其各自的数字os升。
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mtocrowdrise";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "connected succesfully";
这个循环是ax次数,但它只填充了arrayList一次,我做了 This page contains the following errors:
error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.
和一个for循环来打印数组中的数据,无论我运行这个脚本多少次它只添加我输入的最后一个。这是我的班级路线:
private int askStation( ) {
Station po=null;
int id;
consola.println("Id Station?");
id = consola.readInt();
po=station.getStation(id);
if( (po==null)){
consola.println("Unknown Station" );
consola.readLine();
return 0;
}
consola.print( "How many litters ");
int nLiters = consola.readInt();
if (po.checksLiters(nLiters)==false)
consola.println("Invalid Quantity");
else {
//ADD STOP TO THE ROUTE
Stop s=new Stop(po,nLiters);
Route r=new Route(1);
r.addStop(s);
consola.println(r.toString());
}
consola.readLine();
consola.clear();
}
我做错了什么?是添加方法吗?或者在askStation方法循环中初始化对象?
答案 0 :(得分:3)
$( "#my-form" ).submit(function( event ) {
alert( "Handler for .submit() called." );
//event.preventDefault();
return false;
});
您每次都在创建一条新路线,然后在新路线上添加一个停靠点,这样您就会丢失旧路线。为避免这种情况,请在方法之外设置路径,而不是执行
UPDATE t1
SET t1.[age level] = t2.level
FROM table1 t1
JOIN table2 t2 ON t1.[age level] BETWEEN t2.min_age and t2.max_age
另外,
Stop s=new Stop(po,nLiters);
Route r=new Route(1);
r.addStop(s);
应该是
Route r = new Route();