我正在检查数据库中的一列,具体取决于该列中的内容我想重定向到特定页面。
这就是我目前拥有的:
$sql = "SELECT * FROM test WHERE email = '" . $_SESSION['user'] . "'";
$result = $conn->query($sql);
if($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
$lastleftCheck = $row['lastLeft'];
}
}
if ($lastleftCheck == "0") {
header('Location: members.php');
}
if ($lastleftCheck == "1") {
header('Location: members_step2.php');
}
if ($lastleftCheck == "2") {
header('Location: members_step3.php');
}
但它一直在循环,我做错了什么,有人能帮忙吗。
也许这可以帮助您:
var length = filelines.Length;
var columnPosition = 0;
for (int i = 130; i < length; i++)
{
var index = dataGridView1.Rows.Add();
dataGridView1.Rows[index].Cells[columnPosition].Value = filelines[i];
//If the column is 3 set the column position to start value, else increment column position by one
columnPosition = columnPosition == 3 ? 0 : columnPosition + 1;
}
看看这段代码,我希望它会有用:
static void Main(string[] args)
{
long lineNum = 129;
//Load our text file
string myFile = Environment.CurrentDirectory + "''test.txt";
bool b = System.IO.File.Exists(myFile);
if (b == true)
{
var fA = File.ReadAllLines(myFile);
string[] Lines = fA;
for (long i=lineNum ;i<fA.Length;i++)
{
//Do what you want with the lines text from 130 to the end
Console.WriteLine(Lines[i].ToString());
}
}
long lineCount = File.ReadLines(myFile).Count();
Console.WriteLine("These lines read from Line number: 130 " + " to " + lineCount.ToString());
}