0

Each time I run the the SQL statement:

SELECT * FROM tbl_accident WHERE progress = 'on hire' AND progress = 'vd'

But it returns an error:

Notice: Undefined offset: 2 in C:\xampp\htdocs\newclaim\cases.php on line 139
Notice: Undefined offset: 1 in C:\xampp\htdocs\newclaim\cases.php on line 139

Alternatively when I run:

SELECT * FROM tbl_accident WHERE progress = 'on hire';

or

SELECT * FROM tbl_accident WHERE progress = 'vd';

There is no problem. What am I doing wrong? The code at line 138-140 reads:

<td><?php $caseOpen = explode("/", $row_cases['caseOpen']); 
  $caseOpen = $caseOpen[2].'/'.$caseOpen[1].'/'.$caseOpen[0]; 
  echo $caseOpen;?></td>

3 Answers 3

3

try

SELECT * FROM tbl_accident WHERE progress='on hire' OR progress='vd'

You used AND instead of OR in your query. Using AND will never return any result because progress can't be vd and on hire at the same time.

Sign up to request clarification or add additional context in comments.

Comments

1

You are currently always getting 0 rows returned from your select.

Try this:

SELECT * FROM tbl_accident WHERE progress in ('on hire', 'vd')

Comments

1

Please check your sql. You are using progress in where clause more than on time using AND. YOu can use OR instead of AND

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.