Jump to content

fotobleu

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fotobleu's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. apparently i misunderstood the documentation, and "preg_grep" is not supposed to return just the matched parts but returns all the lines that the regex match occurs in, oops
  2. hello php masters im trying to do this, and my head has no hair left ;( $res = preg_grep('/[0-9]*$/',array('foto_1','foto_45')); $res does not contain a array full of numbers ??? has anyone run across this before? thanks -danny
  3. DELIMITER $$ USE ad_behavior; DROP PROCEDURE IF EXISTS maint_pauseAllCreativesNotActiveInAnyAdgroups $$ CREATE PROCEDURE maint_pauseAllCreativesNotActiveInAnyAdgroups() BEGIN DECLARE c_id INT(11) unsigned; DECLARE f_s varchar(255); DECLARE no_more_creatives INT; -- gets creative_ids of all creatives that are not active in any adgroup; DECLARE crs CURSOR FOR select creative_id, group_concat(status SEPARATOR " ") as full_status from adgroup_creatives group by creative_id having full_status NOT LIKE '%active%'; DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_creatives=1; -- loops trough the creative_ids that came back from the cursor above and -- updates the creatives status to paused SET no_more_creatives = 0; OPEN crs; creatives_loop:WHILE(no_more_creatives = 0) DO FETCH crs INTO c_id, f_s; IF no_more_creatives = 1 THEN LEAVE creatives_loop; END IF; UPDATE creatives SET STATUS = 'paused' WHERE id = c_id; SELECT concat('Creative : ',c_id,' was paused.') as message; END WHILE creatives_loop; CLOSE crs; SET no_more_creatives = 0; END $$ DELIMITER ; it craps out on the SELECT concat line, saying its not the right syntax : ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('Creative : ',c_id,' was paused.') as message; END WHILE cr' at line 23 anyone have any ideas, thanks nevermind there were tabs before the select concat statement, stupid me
  4. normalize, you mean split the field containing the comma separated keyword list into individual fields for each keyword, if thats what you mean, then i cant do that for my spec because i'm allowing the user to choose the nr of keyword it wants to enter, is this what you meant by normalize? thanks
  5. yeah thats exactly what i mean, each field has a comma delimited keyword string thats what i thought too, but i wanted to ask to make sure, the problem is how do i differentiate between the keywords in each field and select each one and match each one, i guess you cant do it in mysql, ill do it in php, thanks
  6. hi i have a db with a bunch of records, each record has a comma delimited tag str in it for ex: TAGS black, white, green yellow,white,red green,black,blue gray,orange,white what i want to do trough mysql is get the count for each tag occurrence so for the example above i would get TAG COUNT,TAG NAME 3 white 2 green 2 black 1 yellow 1 orange 1 red 1 blue 1 gray they dont have to be sorted i can do this in php, but im trying to put some of the work on the db, has anyone done this before with a sql statement thanks in advance -daniel
  7. i dont know about that, but you can test it , hope it works
  8. thanks for the reply what if the key would be 'key' instead of "key" how would i reference it? thanks
  9. hi this might help http://www.tech-recipes.com/rx/2139/mysql_increment_an_exisitng_value
  10. ??? hi, i made this function to decode a one level json string function decode($jsonToArr) { $newStr = substr($jsonToArr,1,(strlen($jsonToArr) - 1)); $exArr = explode(",",$newStr); $i = 0; $exArrCount = count($exArr); while($i < $exArrCount) { $splitArr = explode(":",$exArr[$i]); $val = ($splitArr[1]) ? $splitArr[1] : ''; $retArr[$splitArr[0]] = $val; $i++; } return $retArr; } the json tring is this : $testStr = '{"camera":nikon,"aperture":f3.5,"exposure":1/250}'; then i feed it trough my simple decode function $exifArr = decode($testStr); then i try to print the camera echo $exifArr['camera']; but no output is found but when i do print_r($exifArr); i get all the output out, the indexes and the values, along with a 1 at the end does anyone know how come i cannot access the array values this way : echo $exifArr['camera']; thanks
  11. ??? hi, i'm making a simple application i'm thinking of using an XML file as the configuration file for the app, the user will be able to update the config file very easily trough an html form throughout the lifetime of the app, after i deploy it and some users install and use it future versions of the app will have more configuration options and more features therefore i will have to change the config file frequently, in my thinking i dont think its wise to use a DB, because every time a user updates to a new version of the app i would have to change the database, is that a good thing or a bad thing in your guys/girls opinion. if i choose to go with the xml file, will accessing it every time a page renders slow my app down more than a database call? and another issue is that i would like to store login username,pass(hashed) in the config file with the other config info so that the update process from app versions would be made easier thanks
  12. this is funny i keep posting myself, i just realized my mistake, in the sql statement i'm not even pulling some of those column names i'm only pulling fotos_thumbpath lol, noob error
  13. on line $pathToRSSThumb = $row[$chosenPath]; im not getting a value in the $pathToRSSThumb
  14. here is the whole code $result = $dbObj->Query("select fotos_title, fotos_pnr, fotos_thumbpath, fotos_date from fotoblog_fotos order by fotos_date desc limit ".$settingsRow['config_rssAtomCount'].";"); //find out which thumbnail selected to generate $thumbSize = $settingsRow['config_rssAtomThumbSize']; $chosenPath = 'fotos_thumbpath'; //default if($thumbSize == 'S') { $chosenPath = 'fotos_thumbpath'; } else if($thumbSize == 'M') { $chosenPath = 'fotos_thumbforsale'; } else if($thumbSize == 'L') { $chosenPath = 'fotos_fotopath'; } ///echo $row[$chosenPath]; if(mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { //$pathToRSSThumb = fixFotoPath($row[$chosenPath]); $pathToRSSThumb = $row[$chosenPath]; //echo "rss thumb path ".$pathToRSSThumb.'<br/>'; $echoStr .= '<item> <title>'.$row[fotos_title].'</title> <link>'.$headCode.$dname.'?pnr='.$row[fotos_pnr].'</link> <description> <img src="'.$headCode.$dname.'/'.$pathToRSSThumb.'"> <br /> </description> <pubDate>'.date('c',strtotime($row[fotos_date])).'</pubDate> </item>'; } } $echoStr .= '</channel></rss>'; echo $echoStr;
  15. im trying to get data from a certain cell in the row this is what i have so far <code> $chosenPath = 'fotos_thumbpath'; //default if($thumbSize == 'S') { $chosenPath = 'thumbpath'; } else if($thumbSize == 'M') { $chosenPath = 'thumbforsale'; } else if($thumbSize == 'L') { $chosenPath = 'fotopath'; } echo $row[$chosenPath]; </code> on the echo statement nothing gets displayed, i checked the db and there is data in those rows, i think it has something to do with the $chosePath variable, any ideas? thanks in advance regards -daniel
×
×
  • 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.