#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    25
    Rep Power
    0
    My apologies for the length of this - it requires a bit of explanation. I have 2 databases. Database 1 is fully populated while db2 is not. When I list the contents of db1, I need to query a single field in db2. An id key links the 2 db's, allowing me to pull an ownership flag from db2 and apply it to db1. That field may be null, but it may also contain a zero or a one (I'm populating the db via a checkbox). I am trying to peel out that one and use it to set an icon when any contents of db1 are listed.

    So far, I've tried the 'mysql_num_rows' but that pulls back all the ones plus all the zeroes - no good. I can differentiate between the data but, even though I get the results I want, I also get the '$xxx is not an object' message when I fetch and it hits nulls and blows up in the fetch. I've tried all sorts of if statement, isSets, and even tried to set all the non 1 data going into that field into nulls so I could use the num_rows, but, so far, zip.

    I've looked at the mySQL forum and while there is a similar question, mine is a stop beyond. Also have been all through the PHP site plus my well worn copy of O'Reilly's "MySQL and mSQL"

    The select statement currently looks like:
    $stockquery=mysql_db_query('models',"select own from vehicles where not isnull(stock) and carID=$carID ");

    Thanks for any help anyone could offer. And, again, sorry for the length.

    bbarker
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Maybe I'm missing something because this seems obvious. Instead of not isnull(stock) why not use where stock=1?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    25
    Rep Power
    0
    Doh! I've been looking at this waaaay too long. I could feel there was an easy solution but just couldn't get it off the tip of my brain. Changed the selected, reverted back to the num_rows function and all is great. Thanks!

Similar Threads

  1. Check MySQL Version thru PHP
    By wolftrap1 in forum PHP Development
    Replies: 2
    Last Post: February 11th, 2004, 08:51 PM
  2. Replies: 0
    Last Post: February 10th, 2004, 11:44 PM
  3. Replies: 0
    Last Post: January 30th, 2004, 01:22 PM
  4. PHP 5 (MYSQL vs. SQLite)
    By ignition in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 12:13 PM
  5. PHP Reconfig with mysql...
    By Legendary Fox in forum PHP Development
    Replies: 3
    Last Post: January 22nd, 2004, 11:46 PM

IMN logo majestic logo threadwatch logo seochat tools logo