|
Posted by Sheldon Glickler on 03/01/06 13:50
"Steve" <ThisOne@Aint.Valid> wrote in message
news:pan.2006.03.01.09.52.57.477061@Aint.Valid...
> On Tue, 28 Feb 2006 21:06:58 -0500, Sheldon Glickler wrote:
>
>> I have code that does not delete from a database. The same code (cut an
>> paste in the same file, but different function and having a different
>> query)
>> works. So, of course, I tested the query interactively. I echoed the
>> query
>> and did a cut and paste when interactively connect to the database. That
>> one worked so it isn't the query since interactively it is seeing exactly
>> the same thing as the code produces.
>>
>> Here is the code:
>>
>> function deleteCatalog($catalog) {
>> $query = "DELETE FROM CatalogNames WHERE sCatalogID='" . $catalog .
>> "'";
>> mssql_select_db($database_Login, $_SESSION['Login']);
>> $result = mssql_query($query, $Login);
>> ...
>> }
>>
>> The $query echos:
>> DELETE FROM CatalogNames WHERE sCatalogID='CMP'
>>
>> As an example of code that works (in the same file)
>> function addToCatalog($cat_id, $cat_name) {
>> $query = "INSERT INTO CatalogNames (sCatalogID, sCatalogName) " .
>> "VALUES ('" . $cat_id . "', '" . $cat_name . "')";
>> mssql_select_db($database_Login, $_SESSION['Login']);
>> $result = mssql_query($query, $_SESSION['Login']);
>> ...
>> }
>>
>>
>> The second and third lines are identical (cut and pasted) as in other
>> places
>> in the same code. In fact, it is only in this file that I do all the
>> database work. Every other function works. This is the only delete,
>> however.
>>
>> Any ideas?
>>
>> Shelly
>
> Some error handling *might* shed some light onto the problem???
I have an
if (!$result)
print the error including the query
That is how I got the query that I copied and used interactively
successfully. Everything before that looked fine.
[Back to original message]
|