?
Solved

Checking record has been deleted?

Posted on 2006-04-08
4
Medium Priority
?
652 Views
Last Modified: 2013-12-12
Im deleting records and wnating to check it has been deleted to direct to another page or show error if not. Im using ODBC so i cant use the simple mysql_affected_rows and odbc_affected_rows doesnt seem to be working. A sample of what im wanting to do is below. Is any other way around it?

==========

if(odbc_affected_rows() == 1){
'do something'
} else {
'something else'
}
0
Comment
Question by:generali
  • 2
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16406602
http://de3.php.net/manual/tw/function.odbc-num-rows.php

if(odbc_num_rows() > 0){
'do something, row(s) delete'
} else {
'something else'
}
0
 
LVL 2

Author Comment

by:generali
ID: 16406653
I tried that and it returns an error saying wrong parameter count. I forgot to mention my DB is access and i think that odbc_num_rows() returns -1 for access. So with that ill never meet the true criteria. Is there another way i can check if record has been deleted/updated?

Cheers
0
 
LVL 2

Author Comment

by:generali
ID: 16406665
Just thought i'd add the delete that i checked the above on does actually work on only one row, so the desired result from the odbc_num_rows() should have been 1.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 800 total points
ID: 16406697
you have to pass the result handle of the delete operation:

$query = "DELETE ... ";
$result = odbc_exec($dbc, $query);
$rows_affected = odbc_num_rows($result);
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question