Jump to content

[SOLVED] Variable Problem


solon

Recommended Posts

Hey guys, I have a variable that is within a while loop:

i.e:

while($row = mysql_fetch_array($result)
{
$var = $row[some_value];
}
if ...
{
   if
  {

...
  }
...
}

$var // i need to use the variable somewhere here but i still get it as empty ('')

 

I need that variable ($var) to work outside of the loop... is there a way to do that?

 

Any help would be great...

Link to comment
https://forums.phpfreaks.com/topic/137664-solved-variable-problem/
Share on other sites

Sorry I misread your question slightly before...

 

Can you post your actual code? Also how many rows are pulled from that database (roughly)? Just that $var is going to be overwritten every time your 'while' makes a loop and it could just be that the last record returned is simply empty!

 

A

Guys thanks for the responses but i solved it! the question was for carrying the value for later use but actually i didn't have to do anything, as it seems the value is being carried . I could not see it before cause i had an error in my sql query! Sorry for that.. and thanks again

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.