所以我试图检查这个数组是否有下划线。我不确定我是否使用了正确的功能来执行此操作。任何输入将不胜感激。
更多信息,如果数组确实有下划线,我希望它运行下面的代码。这段代码分开并给了我我想要的属性。我还检查它是否有和 S 然后运行一些代码。这些都是查询的输出,然后在最后进行查询。
if (count($h)==3){
if (strpos($h[2], '_') !== false) // test to see if this is a weird quiestion ID with an underscore
{
if (strpos($h[2], 'S') !== false)
{
// it has an S
$underscoreLocation = strpos($h[2], '_');
$parent = substr($h[2], 0, $underscoreLocation - 6); // start at beginning and go to S
$title = substr($h[2], $underscoreLocation - 5, 5);
$questions = "select question from lime_questions where sid =".$h[0]." and gid =".$h[1]." and parent_qid =".$parent." and title =".$title.";";
}
else
{
// there is no S
$underscoreLocation = strpos($h[2], '_');
$parent = substr($h[2], 0, $underscoreLocation - 2);
$title = substr($h[2], $underscoreLocation - 1, 1);
$questions = "select question from lime_questions where sid =".$h[0]." and gid =".$h[1]." and parent_qid =".$parent." and title =".$title.";";
}
}
else
{
$questions = "select question from lime_questions where sid =".$h[0]." and gid =".$h[1]." and qid =".$h[2].";";
}