Sybase Business Intelligence Solutions - Database Management, Data Warehousing Software, Mobile Enterprise Applications and Messaging
Sybase Brand Color Bar
delete

Search for    in all of Sybase.com
view all search results right arrow
  blank
 
 
 
 
 
 
 
 
 
 

 
 
CLICK TO EXPAND NAVIGATION
CLICK TO EXPAND NAVIGATION
Downloads > Code Samples & Utilities > Deleting data in SQL Anywhere with PHP

Deleting data in SQL Anywhere with PHP
 
RSS Feed
 
 
 

Description:
Deleting data from a SQL Anywhere database can be accomplished by performing a sasql_query() call to execute a DELETE statement. The sasql_query() function prepares and executes the DELETE statement identified by the connection that is passed in.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

    #*********************************************************************     
    # Description:
    # Deleting data from a SQL Anywhere database can be accomplished by
    # performing a sasql_query() call to execute a DELETE statement.
    # The sasql_query() function prepares and executes the DELETE
    # statement identified by the connection that is passed in.
    #
    #*********************************************************************

    # Connect using the default user ID and password
    $conn = sasql_connect ( "UID=DBA;PWD=sql" ) ;
    if ( ! $conn ) {
       echo "Could not connect! \n " ;
       echo sasql_error ( ) ;
       exit ( ) ;
    }
    echo "Connected successfully! \n " ;

    # Execute a DELETE statement
    $stmt = 'DELETE FROM my_test_table WHERE name = \' John \' ' ;
    $result = sasql_query ( $conn , $stmt ) ;

    # Report any errors
    if ( ! $result ) {
       echo "sasql_query failed!" ;
    } else {
       echo "query completed successfully \n " ;
    }
    sasql_close ( $conn ) ;

?>

 

Copyright 1994-2009 iAnywhere Solutions, Inc. All rights reserved. This sample code is provided AS IS, without warranty or liability of any kind.
You may use, reproduce, modify and distribute this sample code without limitation, on the condition that you retain the foregoing copyright notice and disclaimer as to the original iAnywhere code.

 
 
 

 
© Copyright 2014, Sybase Inc. - v 7.6 Home / Contact Us / Help / Jobs / Legal / Privacy / Code of Ethics