User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 427,753 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,702 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1132 | Replies: 2
Reply
Join Date: Sep 2004
Posts: 9
Reputation: bennetjosem is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bennetjosem bennetjosem is offline Offline
Newbie Poster

Function Problem. Please help

  #1  
Jul 1st, 2005
This one isnt working!
function insertpath($num){
echo "          <td colspan=\"3\" align=\"left\"> <br>\n";
echo "              <b>Date Published</b>:",$Date_Added[$num] ,"<br>\n";
echo "              <b>Sample</b>:",$Sample_Views[$num],"</td>\n";
}
insertpath(0);

But this one Works
echo "          <td colspan=\"3\" align=\"left\"> <br>\n";
echo "              <b>Date Published</b>:",$Date_Added[$num] ,"<br>\n";
echo "              <b>Sample</b>:",$Sample_Views[$num],"</td>\n";

Well not woking in the sense the values of variables ($Date_Added[$num],$Sample_Views[$num]) not coming in the first. Whil in second its working!


Help me
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation: Troy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: Function Problem. Please help

  #2  
Jul 1st, 2005
There are two things you need to do to troubleshoot this problem. INSIDE your function, at the very top, do this:

First, echo out one of the arrays like this:
[PHP]
echo "<pre>";
print_r($Date_Added);
echo "</pre>";
[/PHP]

Then echo out the value of $num:
[PHP]
echo "<hr />".$num;
[/PHP]

You should see that $num = 0, but that your array does not even exist. You forgot one important line at the top of your function:
[PHP]
global $Date_Added, $Sample_Views;
[/PHP]
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote  
Join Date: Jun 2005
Location: Seattle, WA
Posts: 53
Reputation: senexom is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
senexom's Avatar
senexom senexom is offline Offline
Junior Poster in Training

Re: Function Problem. Please help

  #3  
Jul 3rd, 2005
Maybe concat syntax error :o

THIS....
echo "<b>Sample</b>:",$Sample_Views[$num],"</td>\n";

SHOULD BE THIS....
echo "<b>Sample</b>:".$Sample_Views[$num]."</td>\n";
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 12:56 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC