SQL Statement problem

I have this


<?php
require('./db-include.inc');
$IDBConn = OCILogon(DB_USER, DB_PASS, DB_NAME);
$var1 = "A1";
$sql = "SELECT P.*, FROM T,C WHERE T.num = '" + var1 + "'";
$st = OCIParse($IDBConn, $sql);
$ans = OCIExecute($st, OCI_DEFAULT);
?>

I upload it to the webserver, but when I view it on the web, I get this

Warning: ociexecute(): OCIStmtExecute: ORA-00900: invalid SQL statement

What is the correct syntax?
Or, how should I approach my task?




--Nytblade

Comments

  • : $sql = "SELECT P.*, FROM T,C WHERE T.num = '" + var1 + "'";
    You're asking it to select every entry in table P, but you don't name table P in the FROM clause. Maybe you meant:-

    $sql = "SELECT C.*, FROM T,C WHERE T.num = '" + var1 + "'";

    Maybe you should use more descriptive names for your tables too, so whoever has to maintain your code next doesn't feel like hunting you down and doing something painful. :-)

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion