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);
}
?>
PHP.mk документација
odbc_do
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Патека
function.odbc-do.php
Локална патека за оваа страница.
Извор
php.net/manual/en
Оригиналниот HTML се реупотребува и локално се стилизира.
Режим
Прокси + превод во позадина
Кодовите, табелите и белешките остануваат читливи во истиот тек.
Референца
function.odbc-do.php
odbc_do
Референца за `function.odbc-do.php` со подобрена типографија и навигација.
= NULL
Оваа функција е псевдоним на: odbc_exec().
Белешки од корисници 3 белешки
scottmweaver ¶
пред 18 години
phil.nyc ¶
19 години пред
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.
yashkhopade na hotmail dot com ¶
пред 22 години
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.