0

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 :(

3
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by senexom
0

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:

echo "<pre>";
print_r($Date_Added);
echo "</pre>";

Then echo out the value of $num:

echo "<hr />".$num;

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:

global $Date_Added, $Sample_Views;
0

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";

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.