SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: none

  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need a recommendation

    Hi,

    I'm currently writing an artcle for http://www.codingclick.com - my site that is a user logon script with different user permissions. This is mainly teaching the users how to use sessions to keep track of variables but is also teaching how to use MySQL / PHP through a variety of ways.

    My Current position in the article is writing a global.php file for the functions and I need some help, actually a recommendation. I am creating a function for error messages and would like to know a good way to go about it. Here is my current error message function:

    Code:
    function errorMsg($msg) {
    print $msg;
    }
    I'm not sure how well that is and whether it should contain anything else. Can you tell me what you use and what is the most reliable method?

    Thanks for all the replies,
    -Peter McNulty
    Last edited by petesmc; Mar 28, 2001 at 13:48.

  2. #2
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You could make the message bolded and red...

    ie.

    $msg1 = "<b><font color="red">$msg</font></b>";
    echo $msg1;

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could make it take in an aray or a single arg.

    Code:
    	function error($error) {
    		if (is_array($error)) {
    			foreach($error as $val) {
    				$str .= sprintf('<li><font color="#ff0000"><b>%s</b></font></li>%s', $val, "\n");
    				}
    			return $str;
    			}
    		else {
    			return sprintf('<li><font color="#ff0000"><b>%s</b></font></li>%s', $error, "\n");
    			}
    		}
    
    
    	$array = array("You are cool", "You eat dead chickens", "You are the ebst at php");	
    	$str = "You are cool";	
    	print error($array);
    	print error($str);
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish I was the ebst at PHP...
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is why I said ebst because I am certianly not the best
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •