Categories > TinyButStrong general >

correct sytax on tbssql

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: shashi
Date: 2011-06-12
Time: 08:08

correct sytax on tbssql

All 4 of these fail.
What would be the correct way to use them?
$access = $a1db->GetRow("select * from '%1%' where user='%2%' and pass='%3%'",$tablename,$login,$passwod);

$access = $a1db->GetRow('select * from "%1%" where user="%2%" and pass="%3%"',$tablename,$login,$password);

$access = $a1db->GetRow('select * from %1% where user=%2% and pass=%3%',$tablename, $login,$password);

$access = $a1db->GetRow("select * from %1% where user=%2% and pass=%3%",$tablename, $login,$password);

A simpler syntax works however:
$month = $a1db->GetVal('select current_date - interval %1% month',$value);
works ..
also works when ' replaced with "
$month = $a1db->GetVal("select current_date - interval %1% month",$value);
Thanks,
Shashi
By: TomH
Date: 2011-06-13
Time: 12:28

Re: correct sytax on tbssql

Hi Sashi

Semi-quotes are needed to surround string values in MySQL queries.

The following syntax works for me
$tablename="data_arrays"; $id=11; $data="";
$access = $Db->GetRow("select * from %1% where id='%2%' and sustainable_data='%3%' ", $tablename, $id, $data);

Hope that helps a little.

Thanks to skrol29 for TBS - every day,
TomH