Jump to content


Photo

mysql problem


  • Please log in to reply
6 replies to this topic

#1 eranwein

eranwein
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 02 April 2006 - 01:30 PM

i have two tables: tblItem and tblItemColor.

i want to delete some records from the tblItemByColor table.

this is the query i'm trying:

DELETE FROM mydb.tblItemByColor
WHERE item_number = 10
AND (color_number = 6 OR color_number = 9)

no rows are effected by running it, although there are records with those properties.

#2 Desdinova

Desdinova
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 02 April 2006 - 02:23 PM

did you try putting the numbers between quotes? ie WHERE col = '10'?

#3 eranwein

eranwein
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 02 April 2006 - 02:37 PM

just did. it doesnt work

#4 Desdinova

Desdinova
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 02 April 2006 - 02:39 PM

are you sure every item is spelled the right way (mind caps and all)?

#5 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 02 April 2006 - 05:13 PM

try it like this
DELETE FROM tblItemByColor 
WHERE item_number = 10 
AND (color_number = 6 OR color_number = 9)
you dont need to call your db (mydb.) it is already being called from your mysql_connect page
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

#6 eranwein

eranwein
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 02 April 2006 - 08:37 PM

i have in my project something like 300 querys. all built with "mydb.", so i'm guessing this is not the reason...

btw, whenever i forgot to call "mydb." it failed to run.

#7 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 03 April 2006 - 08:36 AM

do you have it in a query
mysql_query("DELETE FROM mydb.tblItemByColor 
WHERE item_number = 10 
AND (color_number = 6 OR color_number = 9))or die(mysql_error());
if so add the [or die(mysql_error())] that should tell you the problem
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users