php-windows Digest 18 Nov 2004 04:53:53 -0000 Issue 2472
Topics (messages 24989 through 24991):
Re: PHP access to 64 bit MS SQL Server works ?
24989 by: Frank M. Kromann
MySQL ADODB Error
24990 by: MikeA
24991 by: Carsten Gehling
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
>
> 1) Use ODBC.
> 2) Don't use the mssql extensions. As far as I know (I might be wrong)
this
> extension comes from the old MSSQL 6.5 days, and last time I used it it
> would not handle complex queries.
The library (from microsoft) has not been updated since SQL Server 6.x so
there is no support for data types added to newer versions of the SQL
Server.
There is no problems with complex queries though.
- Frank
--- End Message ---
--- Begin Message ---
I am getting the following error:
ErrorMsg for Database - Error:
There is no error being returned! I cannot figure out what the problem is.
So I am hoping additional eyes will catch it for me. I have debug set on
(as you will see in code below) and this is what is returned:
(mysql): SELECT * FROM Alumni WHERE ((AlumID = 1) AND (Name_First =
"Xxxxxxx") AND (Name_Last = "Yyyyyy") AND (EMail = "[EMAIL PROTECTED]"))
It is correct. I have the MySQL Query tool and have checked it out.
Everything looks good!
And here is the code:
$secure_query = 'SELECT * FROM Alumni WHERE ((AlumID = 1) AND
(Name_First = "'.$_REQUEST['secfirst']
.'") AND (Name_Last = "'.$_REQUEST['seclast'].'") AND
(EMail = "'.$_REQUEST['secemail'].'"))';
$db = mysql_connect($dbhost, $dblogin, $dbpass);
$dbconn->SetFetchMode(ADODB_FETCH_ASSOC);
$dbconn->debug=true;
mysql_select_db($dbname, $db);
$result = &$dbconn->Execute($secure_query);
if (!$mysql_select_db) die ('ErrorMsg for Database - Error: ' .
$dbconn->ErrorMsg());
if ($result->RecordCount() == 0)
{
die ('<font size="+2" color="red"><b>Error validating you. Cannot
continue.</b></font>');
}
$t->set_file('index', 'admin/index2.ihtml');
$t->set_var("orgname", $orgname);
$t->set_var("title", $areadesc);
I did have the SELECT statement after WHERE without the outer parends. I
have tried many, many, many things and cannot get it to work right. It
either accepts everything or rejects everything. LOL I can't win for
losing! You can assume the field and other names are correct. It has to be
a syntax error staring me in the eye somewhere.
Thanks in advance.
Mike
--- End Message ---
--- Begin Message ---
> -----Oprindelig meddelelse-----
> Fra: news [mailto:[EMAIL PROTECTED] vegne af MikeA
> Sendt: 17. november 2004 19:15
> Til: [EMAIL PROTECTED]
> Emne: [PHP-WIN] MySQL ADODB Error
>
>
> I am getting the following error:
>
> ErrorMsg for Database - Error:
>
> There is no error being returned! I cannot figure out what the
> problem is.
> So I am hoping additional eyes will catch it for me. I have debug set on
> (as you will see in code below) and this is what is returned:
>
> (mysql): SELECT * FROM Alumni WHERE ((AlumID = 1) AND (Name_First =
> "Xxxxxxx") AND (Name_Last = "Yyyyyy") AND (EMail = "[EMAIL PROTECTED]"))
>
> It is correct. I have the MySQL Query tool and have checked it out.
> Everything looks good!
>
> And here is the code:
>
> $secure_query = 'SELECT * FROM Alumni WHERE ((AlumID = 1) AND
> (Name_First = "'.$_REQUEST['secfirst']
> .'") AND (Name_Last = "'.$_REQUEST['seclast'].'") AND
> (EMail = "'.$_REQUEST['secemail'].'"))';
> $db = mysql_connect($dbhost, $dblogin, $dbpass);
> $dbconn->SetFetchMode(ADODB_FETCH_ASSOC);
> $dbconn->debug=true;
> mysql_select_db($dbname, $db);
> $result = &$dbconn->Execute($secure_query);
> if (!$mysql_select_db) die ('ErrorMsg for Database - Error: ' .
> $dbconn->ErrorMsg());
> if ($result->RecordCount() == 0)
> {
> die ('<font size="+2" color="red"><b>Error validating you. Cannot
> continue.</b></font>');
> }
> $t->set_file('index', 'admin/index2.ihtml');
> $t->set_var("orgname", $orgname);
> $t->set_var("title", $areadesc);
You are mixing ADODB code with the traditional way of using MySQL. I don't
think that is healthy. Try this instead:
$dbconn = &ADONewConnection('mysql');
$dbconn->PConnect($dbhost, $dblogin, $dbpass, $dbname);
$dbconn->SetFetchMode(ADODB_FETCH_ASSOC);
$dbconn->debug=true;
$result = &$dbconn->Execute($secure_query);
if ($result->RecordCount() == 0)
{
die ('<font size="+2" color="red"><b>Error validating you. Cannot
continue.</b></font>');
}
$t->set_file('index', 'admin/index2.ihtml');
$t->set_var("orgname", $orgname);
$t->set_var("title", $areadesc);
Also note a minor detail about the debug attribute:
$dbconn->debug=true;
Don't confuse this with a boolean value. Correct values are: Empty-string =>
no debugging, non-empty string => Debugging
- Carsten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 265.3.1 - Release Date: 15-11-2004
--- End Message ---