[SOLVED] val and string
Moderator: General Moderators
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
[SOLVED] val and string
echo val 'archive_days'; outputs a string instead if a val. how to output a val instead?
Last edited by stevestark5000 on Mon Mar 07, 2011 11:33 pm, edited 1 time in total.
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: val and string
anyone?
Re: val and string
It's not clear what you are asking. "val" doesn't mean anything to me. Are you trying to cast a string to be a value?? In the first place, that doesn't make sense, and in the second place, you can't do a cast as part of the echo command. What is it that you want to do?
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: val and string
Code: Select all
if($_SESSION['SES_ART_master']->val['archive_days']>0)
$article_tags['HISTORYLINK'] = '<a href="index.php?module=article&viewhistory='. $this->id.'" target="_blank">' . $_SESSION['translate']->it('View Revision History').'</a>';Re: val and string
val is apparently an array and 'archive_days' is an index into that array. I recommend that you determine where that array is created in your script. You might start by just echoing the value, like this: just before that if statement.
Code: Select all
echo "The value of archive days is: ".val['archive_days'];-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: val and string
i got an error when i pasted the code in.
Parse error: syntax error, unexpected '[', expecting ',' or ';'
and when i paste below the code i get this...
Parse error: syntax error, unexpected T_STRING
Parse error: syntax error, unexpected '[', expecting ',' or ';'
and when i paste below the code i get this...
Parse error: syntax error, unexpected T_STRING
Re: val and string
My bad. If your "val" is actually an array, there should have been a $ preceding it, thus:See, that's the problem, I'm having to guess at what's in your code. In any case, it has to be defined earlier in your code, so you should begin by determining what this "val" IS. Where is it defined??
Code: Select all
echo "The value of archive days is: ".$val['archive_days'];-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: val and string
$val['archive_days']; did not output anything yet it is defined in the mysql database as 7. this is strange. I cant find the val function in the module and searching over 3000 files would take too long to find it. is there a quick way to find it?
Re: val and string
$val['archive_days'] can't possibly be defined in your database; it is not a value, nor is it a function, it is an Array. Somewhere in your code there should be a line that declares it and assigns a value to it, perhaps something like:stevestark5000 wrote:$val['archive_days']; did not output anything yet it is defined in the mysql database as 7. this is strange. I cant find the val function in the module and searching over 3000 files would take too long to find it. is there a quick way to find it?
$val=Array();
$val]'archive_days']=14;
I think we're not going to make much progress here. Your questions indicate that you have a lot to learn about PHP before you can describe what your script is doing. I would like to help you, but we are just not communicating.
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: val and string
i am sorry, i meant to say that archive_days is defined in the database as 7. I solved it by finding it in the database. your right, i need to learn a lot first. lets forget this topic and i will study more. thank you for your help in this topic.