473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

DB Error: mismatch

The following code:

$sql = 'SELECT user_id FROM ' . TC_DATA_NEW_TABLE_NAME . 'subscribe
WHERE ' .
TC_UTIL::parentClause($this->getType(), TC_DATA_NEW_TABLE_PREFIX .
'_type');
$res = $this->_db->query($sql, DB_FETCHMODE_ASSOC); if
(DB::isError($res)) { die($res->getMessage() . ' [' .
$res->getUserInfo() . '] - ' .$res->getDebugInfo() . ' in: ' .
__FILE__ . ' at line nr. ' . __LINE__); }

Generates the following error message:

DB Error: mismatch [SELECT user_id FROM data_newsubscribe WHERE
(tc_datanew_type='' OR tc_datanew_type LIKE 'ligfiets' OR
tc_datanew_type LIKE 'ligfiets.links' OR tc_datanew_type LIKE
'ligfiets.links.thuispagina' )] - SELECT user_id FROM
data_newsubscribe WHERE (tc_datanew_type='' OR tc_datanew_type LIKE
'ligfiets' OR tc_datanew_type LIKE 'ligfiets.links' OR tc_datanew_type
LIKE 'ligfiets.links.thuispagina' ) in:
c:\data\www\be\technetium\objects\www\include\TC_D ATA_NEW_MAIL.php at
line nr. 31

Seaching in google gives me lots of the same errormessages, especially
on pages with wiki. The other pages point in the direction of place
holders. In a german newsgroup this error is also discussed (also with
reference to place holders).

I don't use placeholders in the query, zo I don't have any idea how to
solve this problem. Can anybody of you give me please some
suggestions.

Thanks,

Toni
Jul 17 '05 #1
7 11260
Toni wrote:
The following code:

$sql = 'SELECT user_id FROM ' . TC_DATA_NEW_TABLE_NAME . 'subscribe
WHERE ' .
TC_UTIL::parentClause($this->getType(), TC_DATA_NEW_TABLE_PREFIX .
'_type');
$res = $this->_db->query($sql, DB_FETCHMODE_ASSOC); if
(DB::isError($res)) { die($res->getMessage() . ' [' .
$res->getUserInfo() . '] - ' .$res->getDebugInfo() . ' in: ' .
__FILE__ . ' at line nr. ' . __LINE__); }

Generates the following error message:

DB Error: mismatch [SELECT user_id FROM data_newsubscribe WHERE
(tc_datanew_type='' OR tc_datanew_type LIKE 'ligfiets' OR
tc_datanew_type LIKE 'ligfiets.links' OR tc_datanew_type LIKE
'ligfiets.links.thuispagina' )] - SELECT user_id FROM
data_newsubscribe WHERE (tc_datanew_type='' OR tc_datanew_type LIKE
'ligfiets' OR tc_datanew_type LIKE 'ligfiets.links' OR tc_datanew_type
LIKE 'ligfiets.links.thuispagina' ) in:
c:\data\www\be\technetium\objects\www\include\TC_D ATA_NEW_MAIL.php at
line nr. 31

Seaching in google gives me lots of the same errormessages, especially
on pages with wiki. The other pages point in the direction of place
holders. In a german newsgroup this error is also discussed (also with
reference to place holders).

I don't use placeholders in the query, zo I don't have any idea how to
solve this problem. Can anybody of you give me please some
suggestions.

Thanks,

Toni


Hi Toni,

Does the database (which one??) accept that SQL-statement anyway?
Did you try to feed it directly by using commandprompt??
To name something:

tc_datanew_type LIKE 'ligfiets.links'

Maybe tc_datanew_type isn't a text/string but a number????
(Just guessing)

You should give more information to us.
Like: What is the definition of the table you are querying?
What database do you use?

My guess is that you use the WRONG DATATYPE in your query.

Regards,
Erwin Moller
Jul 17 '05 #2
Erwin Moller wrote, in respnse to my question:
Generates the following error message:
DB Error: mismatch [SELECT user_id FROM data_newsubscribe WHERE
(...)
Does the database (which one??)
MySQL (version 3.23.49 on the windows machine and 3.23.56 on the linux
box)

accept that SQL-statement anyway?

Yes:

mysql> SELECT user_id FROM data_newsubscribe WHERE (tc_datanew_type=''
OR tc_dat
anew_type LIKE 'ligfiets' OR tc_datanew_type LIKE 'ligfiets.links' OR
tc_datanew
_type LIKE 'ligfiets.links.thuispagina');
+---------+
| user_id |
+---------+
| 1733 |
| 3 |
| 3 |
| 1835 |
| 2219 |
| 3522 |
| 546 |
| 546 |
| 3815 |
| 4023 |
| 13 |
| 2457 |
+---------+
12 rows in set (0.01 sec)

No problem.
Did you try to feed it directly by using commandprompt??
See above.
Maybe tc_datanew_type isn't a text/string but a number????
(Just guessing)
Sorry, I gave to litte information, but you guessed wrong 8-)

CREATE TABLE `data_newsubscribe` (
`tc_datanewsubscribe_id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default '0',
`tc_datanew_type` varchar(255) NOT NULL default '',
`tc_datanewsubscribe_update` int(11) NOT NULL default '0',
PRIMARY KEY (`tc_datanewsubscribe_id`)
)
You should give more information to us.
Like: What is the definition of the table you are querying?
What database do you use?


Thanks for your efforts.

Sorry, I gave to little information. I hope you (as in the members of
this group) can give me more help with the information I've given
now.

Toni
Jul 17 '05 #3
Toni wrote:
mysql> SELECT user_id FROM data_newsubscribe WHERE (tc_datanew_type=''
OR tc_dat
anew_type LIKE 'ligfiets' OR tc_datanew_type LIKE 'ligfiets.links' OR
tc_datanew
_type LIKE 'ligfiets.links.thuispagina');
+---------+
| user_id |
+---------+
| 1733 |
| 3 |
| 3 |
| 1835 |
| 2219 |
| 3522 |
| 546 |
| 546 |
| 3815 |
| 4023 |
| 13 |
| 2457 |
+---------+
12 rows in set (0.01 sec)

CREATE TABLE `data_newsubscribe` (
`tc_datanewsubscribe_id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default '0',
`tc_datanew_type` varchar(255) NOT NULL default '',
`tc_datanewsubscribe_update` int(11) NOT NULL default '0',
PRIMARY KEY (`tc_datanewsubscribe_id`)
)

Hi Tony,

I see only 1 more thing that is strange.
You use LIKE 'blabla' instead of LIKE '%blabla%'

The % means: match anything (before or after the literal string).

Using LIKE and no % is a little meaningless because it means the same as the
= sign.
But I am unsure if it gives an error.
I have never touched MYSQL (I am a postgresql fanatic), but have a look if
that is the source of the error.

Sorry I cannot help you any futher.

Good luck.
If you find the solution, be sure to post it here for others to enjoy. :-)

Regards,
Erwin Moller
Jul 17 '05 #4
Erwin Moller wrote:
I see only 1 more thing that is strange.
You use LIKE 'blabla' instead of LIKE '%blabla%'
I know, this code is in a function that allows the use of wildcards.
But I am unsure if it gives an error.


I never hurts to test, but I don't think it matters since phpmyadmin
uses them in the same way.

DB Error: mismatch [SELECT user_id FROM data_newsubscribe WHERE
((tc_datanew_type = '') OR (tc_datanew_type = 'ligfiets') OR
(tc_datanew_type = 'ligfiets.links') OR (tc_datanew_type =
'ligfiets.links.thuispagina') )] - SELECT user_id FROM
data_newsubscribe WHERE ((tc_datanew_type = '') OR (tc_datanew_type =
'ligfiets') OR (tc_datanew_type = 'ligfiets.links') OR
(tc_datanew_type = 'ligfiets.links.thuispagina') ) in:
c:\data\www\be\technetium\objects\www\include\TC_D ATA_NEW_MAIL.php at
line nr. 31

Nope, same result. After the change from like to = I also added extra
parentheses, bebause I was unsure about the order of operators. The
message I've included in my post is from that test.

Could this be a bug in either PEAR, PHP or MySQL and do you know
how/where to check this?

Thanks for your efforts,

Toni
Jul 17 '05 #5
Toni wrote:

<snip>

Could this be a bug in either PEAR, PHP or MySQL and do you know
how/where to check this?
Hi Tony,

I think you might be right this is maybe a bug.

I would suggest that you just repost in this group with 'PEAR-DB BUG' in the
subject.
Maybe that will attrack the attention of some PEARDB-guru.
I am out of ideas and am far from a PEARDB-guru.


Thanks for your efforts,

You are welcome.
Toni


Good luck!

Regards,
Erwin Moller
Jul 17 '05 #6
I wrote:
(...)
$res = $this->_db->query($sql, DB_FETCHMODE_ASSOC); if

(...)
Without knowing the second argument is a list of parameters, and not a
way to set the fetchmode. Removed it, and set the fetchmode at the
appropriate place => problem solved.

Sorry for bothering you,

Toni
Jul 17 '05 #7
Toni wrote:
I wrote:
(...)
$res = $this->_db->query($sql, DB_FETCHMODE_ASSOC); if

(...)
Without knowing the second argument is a list of parameters, and not a
way to set the fetchmode. Removed it, and set the fetchmode at the
appropriate place => problem solved.

Sorry for bothering you,

Toni


Glad you found it. :-)

Regards,
Erwin Moller
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Briley | last post by:
For some reason, my posts are scrubbed as attachments. Lets hope that sending from the yahoo account works. I'm new to Python and I'm trying to do some database work with MS Access, but I can't...
2
by: Steve Briley | last post by:
I'm new to Python and I'm trying to do some database work with MS Access, but I can't seem to get around a "datatype mismatch error".&nbsp; Here's an example table that I'm working with... ...
6
by: DrewM | last post by:
This is a strange request - but I'm trying to generate a Type Mismatch error. It's for an example in some documentation. I was looking for something that would error (like a mathematical equation...
5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
19
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without...
9
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include...
5
by: kjworm | last post by:
Hello Everyone, I have been fighting with a type mismatch error for many hours today and I can't seem to find what the problem is. Hopefully it is more than a missing apostrophe! I have isolated...
9
by: sara | last post by:
Hi - I have code (below) that ran as recently as Monday. We decided to change the location for the output reports, and now the code errors (13 Type Mismatch) on the query. The query runs fine...
0
by: =?Utf-8?B?ZnJmYWxsYXM=?= | last post by:
Hello, I had an error starting outlook that says my mailbox.pst file is corrupted, I have runned the scanpst tool as te dialog box says, nothing happened, I created other data file named...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.