On 04 January 2008 17:06, afan pasalic wrote:
> hi
> I have function
> function get_content($client_id, $form_id, $index1) {
> $query = mysql_query("
> SELECT content
> FROM infos
> WHERE client_id=".$client_id." AND
> form_id=".$form_id." AND
> index1='".$index1."'");
> if (mysql_num_rows($query) > 0)
> {
> $result = mysql_fetch_assoc($query);
> return $result['content'];
> }
> else
> {
> get_content(0, 0, $index1); // get default value
return get_content(0, 0, $index1);
> }
> }
That's the only obvious error I can see -- I guess the query's returning zero
rows for (12, 104, 'merchant').
There's a possible infinite recursion in there, though -- if there are *no*
rows in the table with index1=merchant, this thing will just recurse crazily
until it bombs. One way to prevent this would be:
elseif ($client_id!=0 || $form_id!=0)
{
return get_content(0, 0, $index1);
}
else
{
return NULL; // or FALSE, or some other error indicator
}
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730 Fax: +44 113 812 3211
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php