| | |
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 basic body broken cache cakephp class cms code computing confirm cron curl customizableitems database date date/time delete dynamic email error file filter folder form forum freelancing function functions gc_maxlifetime google header headmethod howtowriteathesis href htaccess html iframe image include ip javascript joomla limit link list login malfunction memmory memory menu method msqli_multi_query multiple mycodeisbad mysql navigation neutrality oop parameter parsing paypal pdf php phpmysql query question random recourse regex root script search select seo server sessions snippet soap source space sql static support! system table thesishelp trouble tutorial update upload url variable video web webdesign xml youtube





