Jump to content

derrick24

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

derrick24's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. IF I could do the as posted above, I would not have to write something like below. if(count($newArray) > 0) { // Combine products with number or orders foreach($newArray as $key => $value) { foreach($array as $subKey => $subValue) { if ($newArray[$key]['id'] == $subKey) { $newArray[$key]['amount'] = $subValue; } } } return $newArray; }
  2. Hi, is it possible to create an extra field during a select query and set the values of that field. ie: fakeField does not exist in the database, but I need it to be part of the returned array for manipulation in php SELECT table.*, table.fakeField=10 FROM table thanks
  3. Because I don't want to display blank fields to the end user, php generates the data from the returned result automatically and Id rather have mysql filter it out as apposed to php.
  4. Hi, I'm trying to prevent mysql from returning null or empty fields without specifying each field. Im trying to do something like the following: SELECT (ONLY NON NULL FIELDS) FROM vine_details WHERE id = 12 for example. ???
  5. SOLVED! SELECT vine_tags.title, vine_listings.* FROM vine_listings LEFT JOIN vine_tags ON vine_listings.tags REGEXP CONCAT('[[:<:]]', vine_tags.id, '[[:>:]]') Thanks for all your help guys.
  6. The tags field consists of integers representing the id of the tags table, ie 1-2-5-6- = to the id of the tag for example. All I'm really trying to do is prevent tags from showing up if nothing is associated with it. Pointless having the user click on a tag only be told there is no associated data for that tag. Anyway, that query is not working for some odd reason. I'm starting to think its not doable. TAG TABLE ID TAG HITS 1, 'Kitchens', 0 2, 'Cupboards', 0 3, 'Cabins', 0 4, 'Huts', 0 5, 'Sheds', 0 6, 'Flooring', 0 7, 'Tiles', 0 SEARCH TABLE ID DETALS TAGS 1, 6, '1-2-9-' 2, 8, '3-4-5-' 3, 4, '6-7-' 4, 2, '1-2-' 5, 1, '21-17-'
  7. yeah I have been, I think the REGEX syntax part is wrong, as its treating vine_tags.id as a normal string. maybe it should be something like: '[[:<:]]' . vine_tags.id . '[[:>:]]' but that does not work either.
  8. SELECT vine_tags.title, vine_listings.* FROM vine_listings LEFT JOIN vine_tags ON vine_listings.tags REGEXP '[[:<:]]vine_tags.id[[:>:]]'
  9. Thank you very much, that information is extremely helpful! Much appreciated.
  10. CREATE TABLE `tgv`.`gv_ads` ( `id` int(10) NOT NULL auto_increment, `flag` int(1) default '0', `counter` int(10) default '0', `cat` varchar(255) default NULL, `title` varchar(255) default NULL, `address` varchar(255) default NULL, `tel` varchar(45) default NULL, `fax` varchar(45) default NULL, `cell` varchar(45) default NULL, `email` varchar(100) default NULL, `url` varchar(255) default NULL, `description` text, `image` varchar(255) default NULL, `error` int(11) unsigned default '0', `area` varchar(45) default NULL, `updated` date default NULL, `tel_a` varchar(45) default NULL, `tel_b` varchar(45) default NULL, `tel_c` varchar(45) default NULL, PRIMARY KEY (`id`), KEY `id` (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4745 DEFAULT CHARSET=latin1; Hope that helps, and Ive attached an extract from the database. [attachment deleted by admin]
  11. This looks cool. might need to incorporate something like this into my own project.
  12. I'm trying to find out how many updates where done during the month of April, thing is I'm also getting 2007 entries and I don't think this is correct. SELECT * FROM ads WHERE (flag = 0) AND (updated > 2008-03-29 AND updated < 2008-05-01) order by updated
  13. This is more of a concern of mine, and I'm not too sure of how to even ask this question. I have at the start of my script a normal connect to the database connection that can be used though out the remainder of the script by various functions (so basically any function can simply pull the data it requires without having to connect every time) Now my concern is that I need to use "mysql_insert_id", if I have multiple uses inserting records in the database using the same connection started at the top of the script. Is that going to cause a conflict. ie: if userA inserts record 1 and userB insert record 2 at the same time. will userA still get a return id of 1 and userB a return id of 2 and not both get a return of 2 for example?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.