Current location: Hot Scripts Forums » Programming Languages » PHP » arrays in functions


arrays in functions

Reply
  #1 (permalink)  
Old 01-28-05, 09:51 PM
Slypher Slypher is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
arrays in functions

alright, im typing a huge functions script, and i wanna use arrays for some of my functions.

function Error($array){
global $sql;
echo $array['field'];
return TRUE;
}

when i do that it doesnt echo, meaning it wont show my field. it acts as if nothings there

i even tried doing global $sql, $array; but that didnt work either, anyone know if i can use arrays or another way or something?
Reply With Quote
  #2 (permalink)  
Old 01-29-05, 04:47 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
you can use arrays! many softwares use them!
just print_r($array) inside this function and see what you get..
I think that ['field'] might be empty ..
because your code is 100% syntax correct!
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 01-29-05, 07:54 PM
Slypher Slypher is offline
Newbie Coder
 
Join Date: Jan 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
this is my array

$array = array("field" => "2", "username" => $this->username, "password" => $this->password);
Reply With Quote
  #4 (permalink)  
Old 01-30-05, 05:36 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
Quote:
Originally Posted by Slypher
$array = array("field" => "2", "username" => $this->username, "password" => $this->password);
that's pretty strange!
you used print_r() inside the function body, right?
if you can see results coming from print_r() then you should also see from echo!
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Deal With Parenthesis' in Arrays? cebuy PHP 0 11-27-04 02:46 PM
functions shashiu JavaScript 2 10-25-04 09:54 AM
**** functions always error mugen C/C++ 3 06-27-04 04:57 PM
Two useful functions Styric PHP 0 01-31-04 09:05 AM
Array passing between functions alfreds PHP 1 08-25-03 05:29 AM


All times are GMT -5. The time now is 05:28 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.