[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-db
Subject:    Re: [PHP-DB] Problem with passing variable to mssql
From:       James Gadrow <jgadrow () lawriter ! net>
Date:       2007-06-28 15:35:59
Message-ID: 4683D55F.4080605 () lawriter ! net
[Download RAW message or body]


> William Curry wrote: 
>> $qry1 = "SELECT *,CONVERT(Char(24),CALL_ENTRY_DATE,101) as MYDATE 
>> from PcarsCallComplete
>> where Location_address = " .$Location2. " order by CALL_NO";
This method usually works well for me for debugging purposes:

immediately prior to query, echo it to see exactly what you're telling 
mysql and then exit the script so it's the only output.
Log in to mysql as the user that your script is logging in as (just in 
case it's a permission setting)
Enter sql via copy & paste
Check results.

So, for you:
echo "\$qry1 = \"SELECT *,CONVERT(Char(24),CALL_ENTRY_DATE,101) as 
MYDATE from PcarsCallComplete where Location_address = $Location2 order 
by CALL_NO\";";

Enter output into mysql (obviously only the code between the quotes) and 
run query. Be sure you're logged in as the same user that the script 
logs in with, else you may have different privileges!

If you don't receive an error or an empty set in mysql, then it could be 
something simple yet hard to diagnose. Perhaps you're inserting (and 
logging directly in) to a different database than your script is reading 
from (such as if you have multiple comps on your network acting as 
servers, perhaps you're trying to select from the wrong machine's database).

Thanks,

Jim

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic