Closed Thread Icon

Preserved Topic: Variable reset to "" Pages that link to <a href="https://ozoneasylum.com/backlink?for=21129" title="Pages that link to Preserved Topic: Variable reset to &amp;quot;&amp;quot;" rel="nofollow" >Preserved Topic: Variable reset to &quot;&quot;\

 
Author Thread
Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 09-06-2002 11:49

Yes!!

Why my variable $img1 gets the '' (empty) value after a query?
The query is here:

code:
$query_select = "select img1,thumb1,img2,thumb2,img3,thumb3,img4,thumb4 from post where ID = " . $id . "";
$result_select = mysql_query($query_select, $link);
$num_posts = mysql_num_rows($result_select);
while ($row = mysql_fetch_array($result_select)) {
if (($img1 = "") && (file_exists("/inlander/sites/parejasliberales-com/web/htdocs/guest/".$row[0].""))) {
unlink ("/inlander/sites/parejasliberales-com/web/htdocs/guest/".$row[0]."");
unlink ("/inlander/sites/parejasliberales-com/web/htdocs/guest/".$row[1]."");
}
}



And i need that variable for later!
I made a test to seee where the variable gets reset (I added the 'echo $img1;' line part by part) and it keeps its value till it arrives to the conditional, after that, it's empty.

The conditional is not executed, due to the $img1 variable is not empty!

do I make myself clear?

Edit: Oh!! the variable $img1 comes from a form in other page.... (post method)

[This message has been edited by Wakkos (edited 09-06-2002).]

genis
Paranoid (IV) Inmate

From: Dallas, TX
Insane since: Aug 2002

posted posted 09-06-2002 12:00

don't hit your head too hard, but you put

code:
if (($img1 = "")



gotta put ($img1 == "")



edit: oh you prolly wanted != ... either way. you get me.

[This message has been edited by genis (edited 09-06-2002).]

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 09-06-2002 12:11

If I do that, it execute the conditional! even if the variable is not "".....

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 09-06-2002 12:44

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

genis
Paranoid (IV) Inmate

From: Dallas, TX
Insane since: Aug 2002

posted posted 09-06-2002 12:44
quote:
do I make myself clear?

Uh... guess not.

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 09-06-2002 13:46

$img1 is NOT recovered from database, it comes from a text box in a formulary!

Then, i want to make some database stuff only if the variable is empty (the text box in the formulary)
The variable comes ok to the proccess page, but when this conditional into the while stuff is executed (or not) this variable gets the '' value!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 09-06-2002 13:55

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 09-06-2002 14:13

Great!! in this way works cool!!!!!!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 09-06-2002 14:47

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu