| | |
Function Problem. Please help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2004
Posts: 9
Reputation:
Solved Threads: 0
This one isnt working!
But this one Works
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
PHP Syntax (Toggle Plain Text)
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
PHP Syntax (Toggle Plain Text)
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
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]
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]
![]() |
Similar Threads
- Function problem (C++)
- Insertion Sort Problem (C++)
- Ask Function problem?thanks (C)
- Abstract Class member function problem (C++)
- using OCI to call a ORACLE stored function (C++)
- static function problem (C++)
- AnsiString Template Data Return Problem Builder 6 (C++)
Other Threads in the PHP Forum
- Previous Thread: Money for Help
- Next Thread: Error with tables overlapping
| Thread Tools | Search this Thread |
apache api array auto beginner binary broken cache cakephp checkbox class cms code codingproblem cron curl customizableitems database date display dynamic echo email error file files filter folder form format forms forum function functions gc_maxlifetime global google headmethod host href htaccess html image include insert ip javascript joomla limit link login mail malfunctioning memmory memory menu mlm multiple mysql nodes oop parameter parsing paypal pdf php phpmysql popup query radio random recursion recursiveloop remote script search select server sessions sms snippet source space sql static survey syntax system table trouble tutorial up-to-date update upload url validator variable video web youtube





