|
Posted by ZeldorBlat on 02/23/06 01:06
Justin Koivisto wrote:
> Sheldon Glickler wrote:
> > I have a script, testsql.php that I run and it works well.
> >
> > Here are the guts:
> >
> > session_start();
> > require_once("sqlLoginDB.php");
>
> If this is going into a function or included file, it should be an
> absolute path. For instance, if the sqlLoginDB.php file is lcoated in
> the same directory where this code is found, you should use:
>
> require_once dirname(__FILE__).'/sqlLoginDB.php';
>
> That way, no matter what the current working directory is, the file can
> be found.
Absolutely not. This would imply that sqlLoginDB.php lives in the same
(internet-accessible) directory as the calling file. Files that you
include (database connection code, class definitions, etc.) should live
in a directory /outside/ the webserver document tree. Set the include
path directive in php.ini appropriately.
>
> > mssql_select_db($database_apbLogin, $apbLogin);
>
> No mssql_connect? IF you paste this into a function, you will need to be
> sure that you are referencing your db connection either through $GLOBAL
> or explicitly define it as global in the function. You should also check
> to see that the call succeeded by checking it's return value.
So I'm guessing that you call mssql_connect() inside sqlLoginDB.php.
What exactly are you pasting into your function? All of the code you
pasted above (including the session stuff) ? Be careful that you
aren't calling session_start() more than once or you might have some
weird problems.
>
> > $_SESSION['curSpeaker'] = '1000129';
> > query = "SELECT * FROM speakers WHERE iOldSpeakerId='" .
> > $_SESSION['curSpeaker'] . "'";
> > $result = mssql_query($query, $apbLogin);// or die(mssql_error());
> > echo "Result: " . $result;
>
> You may want to try something like:
>
> if(!is_resource($result)){
> // there was a query error of some sort
> return mssql_error();
> }else{
> // the query was a success
> }
>
> --
> Justin Koivisto, ZCE - justin@koivi.com
> http://koivi.com
Post what you have inside sqlLoginDB.php as well as the entire function
you have created so we have a better idea of what might be going on.
Navigation:
[Reply to this message]
|