Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

odbc_do

(PHP 3 >= 3.0.6, PHP 4, PHP 5)

odbc_do -- Synonym for odbc_exec()

Description

resource odbc_do ( resource conn_id, string query )

odbc_do() will execute a query on the given connection.



odbc_error> <odbc_data_source
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
odbc_do
scottmweaver
01-Jun-2007 03:27
Hey guys,

I used the following code to run normal double quotes inside my SQL queries. Hopefully this will save someone else a headache or two-

<?php

   
/**
     * Query Function
     * Allows quoted queries to be sent to SQL
     */

   
function query($query, $conn)
    {
       
odbc_do($conn, 'SET QUOTED_IDENTIFIER OFF');
        return
odbc_do($conn, $query);
    }
?>
phil.nyc
04-Dec-2006 07:23
To clear up: the SQL standard requires strings to be inside single quotes: 'string'.  It simply does not accept double quotes for this purpose.

Furthermore, in PHP, you can have a single quote inside double quotes: "select a from b where c = 'string'" without the need to escape.
stalker
16-Nov-2006 12:11
$sql = INSERT INTO table (field1,field2,field3,field4) VALUES ("text value 1", "text 2",3,"text 4")";

of cos u will get an error fro php due to double quotes inside double quotes. The correct way of doing that is

$sql = "INSERT INTO table (field1, field2, field3, field4) VALUES
(\"text1\", \"text2\", \"text3\", \"text4\")";

Dont forget the backslash when u want to insert a " within double quotes.
nmaskell at livingchurch dot net
31-May-2005 07:10
Some of you may be having problems with Access SQL.
I got "Too few parameters" many times before I figured this out.
MS Access does not like double quotes in a SQL string like this:
<?php
$sql
= 'INSERT INTO table (field1,field2,field3,field4) VALUES ("text value 1", "text 2",3,"text 4")';
?>

This resulted in an obscure error: Too few parameters.
So - The following should work much better:
<?php
$sql
= "INSERT INTO table (field1,field2,field3,field4) VALUES ('text value 1', 'text 2',3,'text 4')";
?>
yashkhopade at hotmail dot com
10-Jul-2003 03:53
i have use this function so many times. it works well for my requirements. ok well done...

<?php
         $sqlstr
="SELECT bill_no FROM SCROL";
        
$queryresult=odbc_do($conn,$sqlstr);
        
odbc_fetch_row($queryresult,$bills);

       
// if we want to access the records
        // then we have to write the following code
        
       
echo $bills[0];
     
?>

the out put for this will:

 1
which is actullay first record of resultset.

odbc_error> <odbc_data_source
Last updated: Fri, 26 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571