そのため、この配列にアンダースコアが含まれているかどうかを確認しようとしています。これを行うために正しい関数を使用しているかどうかはわかりません。任意の入力をいただければ幸いです。
さらに詳しい情報ですが、配列にアンダースコアが含まれている場合は、以下のコードを実行してください。このコードは分離して、必要な属性を提供してくれます。また、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].";";
}