Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. That's your script in its entirety? Then that would be because open_image() is an undefined function and you have display_errors set to off. If you were to do: <?php ini_set('display_errors','On'); error_reporting(E_ALL); $image = open_image('test.jpg') or die("No good"); die("yes, it works"); ?> You would recieve the error message that open_image() is an undefined function. If there is more to your script, and you have created the open_image() function, then i would still suggest that there is an error somewhere and you have display_errors set to off
  2. Not particularly - it just makes the generated HTML more readable.
  3. Your code looks pretty confusing. You seem to be making 4 identical queries near the top of your script. I can only assume that, at present, you have a query for each column (not sure what the 4th one is for), which would explain why you cant sort the data? Perhaps reading this FAQ here will show you a better method for putting your results into multiple columns, using just one query. Also, please remember to place your code inside tags when you post.
  4. Well, without your code, its pretty difficult to tell you whats wrong with it. However, i put this together which i think will do what you're after (and possibly more): <?php $array = array('Brand'=>array('Type'=>array(array('ID'=>1,'Name'=>'Plus','Size'=>'XL','Price'=>100),array('ID'=>3,'Name'=>'Shox','Size'=>'XL','Price'=>100)))); function find_items($array,$findwhat,$value,$found=array()){ foreach($array as $k=>$v){ if(is_array($v)){ $result = find_items($v,$findwhat,$value,$found); if($result === true){ $found[] = $v; }else{ $found = $result; } }else{ if($k==$findwhat && $v==$value){ return TRUE; } } } return $found; } $found = find_items($array,'ID',1); echo '<pre>'.print_r($found,1).'</pre>'; ?> This will allow you to search for any product where the attribute matches what you're after. So, in the above example, we can search for a product where the ID is 1. Or, we could search for all products where the size is XL, using: $found = find_items($array,'ID',1); echo '<pre>'.print_r($found,1).'</pre>'; If this isn't what you want, please explain a bit more fully. And post up the code you've got currently.
  5. Well, apart from anything else - your function doesn't return anything, or echo anything. So making a call to this function wont actually do anything.
  6. This seems an awful lot more simple to me: <?php $str = '24 15/16 x 20 1/2 x 39'; $str = preg_replace('|([0-9]+) ([0-9]+/[0-9]+)|','$1<sup>$2</sup>',$str); echo $str; ?>
  7. Hows about: <?php $str = '24 15/16 x 20 1/2 x 39'; $str = preg_replace('|([0-9]+/[0-9]+)|','<sup>$1</sup>',$str); echo $str; ?> That will replace any measurements given as a fraction with the same fraction in superscript
  8. How else would your propose that you design a personal message system? As far as i can see, the only possible change is to have the messages checked for when the page loads, rather than at a fixed interval.
  9. If you order by the date, you can simply monitor when this date isn't the same as the last one, and echo out the new date: <?php $sql = "SELECT `title`,DATE_FORMAT(`date`,'%M %d, %Y') FROM `videos` ORDER BY `date` DESC"; $result = mysql_query($sql) or die(mysql_error()); $curr_date = ''; while(list($title,$date) = mysql_fetch_row($result)){ if($curr_date != $date){ echo '<br />'.$date."<br /><br />\n"; $curr_date = $date; } echo $title."<br />\n"; } ?>
  10. I'm not sure i've ever seem a forum use [em][/em] tags - so that would certainly be confusing to people. So yes, just use the the recognised symbols like and
  11. There's another one here: http://www.sid6581.net/cs/php-scripts/barcode/
  12. So true. Im sure everyone would be a lot happier if we all had a similar thought process.
  13. I didn't take a very active part in the discussion to eliminate the forum games, but I fully support the decision. Don't let the fact that we have a miscellaneous board fool you into thinking that anything goes. There are plenty of other sites devoted to silly nonsense and PHP Freaks doesn't need to join their ranks. I think you misunderstand me; i wasn't suggesting it were a bad decision - merely commenting on the fact that it seems a little unfair that neal would most likely be the one to recieve any flak from any member who did disagree with the decision.
  14. Yeah, to get anything which will look professional, you will need someone fluent in both languages. Online translations are always gisted, and thats not much good for a business.
  15. It needs to be strtolower(): //Directory Creation Checking $newDir = is_dir('submissions/2008_2009/'. strtolower($cFirstName .$cLastName)); //Create New Submissions Folder if ($newDir == false) { mkdir("submissions/2008_2009/". strtolower($cFirstName . $cLastName)); } else { echo "Sorry this person has already been nominated"; }
  16. No problem, if you're all done here - can you mark this as solved? Edit: Whoops, you already did
  17. Try: //Directory Creation Checking $newDir = 'submissions/2008_2009/$cFirstName$cLastName'; //Create New Submissions Folder if (!is_dir($newDir)) { mkdir("submissions/2008_2009/$cFirstName$cLastName"); } else { echo "Sorry this person has already been nominated"; }
  18. The call to session_start(); must be sent before any headers. Headers will get sent with the first output to the browser - so the call to the function must be called before any output. In other words, move the session_start() function above everything else including the document type definition.
  19. Your code seems slightly bizarre - if you are allowing the users to edit the name of the meal, then how can you expect to retrieve this from the form using the old name stored in the database?
  20. The names of the two fields you have used are LastModBy and FKcontent. These will be the names of the keys in the $_POST array, and so need to be the names used to access these variables. You should have: $RecordID = $_POST['PKcontent']; $LastModBy= $_POST['LastModBy'];
  21. Well, you can accomplish a lot with the mysql query. With this, i've assumed that you have a field called condition_id in both tables. Try: <?php $sql = "SELECT m.condition_name, m.condition_id,a.app_id FROM medical_conditions as m "; $sql .= "LEFT JOIN application_medical_conditions as a ON a.condition_id=m.condition_id "; $sql .= "WHERE (a.app_id=$appid OR a.app_id is null) AND m.condition_type='warrior'"; $result = mysql_query($sql) or die(mysql_error()); while(list($condtion_name,$condition_id,$app_id) = mysql_fetch_row($result)){ if($app_id != NULL){ $checked = 'checked="checked"'; }else{ $checked = ''; } echo $condition_name. ' <input type="checkbox" name="'.$condition_id.'" '.$checked.' /><br />'."\n"; } ?> My mysql can be a bit rusty at times, but i think that should do the trick.
  22. Whoops, mind is focused on lunch Haha, i know the feeling - though mine's usually focused on bed!
  23. This still isn't going to do what you're after. Your code doesn't make sense. mysql_num_rows() returns the number of records that you've selected from the database. It doesn't make sense to use this as a constraint within a loop that's looping through a record at a time. If you tell us what you're trying to achieve, we might be able to tell you the best way to go about it.
  24. You need to be selecting where the date is greater than or equal to 3 days ago: $query_SearchAllUnverified = "SELECT * FROM dish WHERE date>=(NOW() - INTERVAL 3 DAY) AND status='UN-VERIFIED'";
×
×
  • 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.