Re: [PHP] Variables changes their values
On Tuesday 03 June 2003 13:58, Jay Blanchard wrote: [snip] We would have to see some code Jay I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: Either this is a bad cut and paste job or this script will never run because it's full of errors. Either way, if $lid changes, it's because you're changing it. Maybe you have an if($lid = 'value') instead of if($lid == 'value') somewhere? if ($hostid==31) echo lid1: $lid; # Paragraphs # if ($bodytype==1) { sql_query(UPDATE tblArticleParagraph SET sort=-1 WHERE artid=$lid AND hostid=$session_hostid); $tmpbody = ''; for ($i=0; $icount($paragraphs); $i++) { $popt = 1; $popt = $popt | (($parhardoutline[$i]) ? 0x2 : 0); $parpicurl[$i] = preg_replace(/'/s,'',$parpicurl[$i]); $parheadline[$i] = trim($parheadline[$i]); $parpictext[$i] = trim($parpictext[$i]); if ($hostoptions0x80) { # STRICT FONT/STYLE STRIP $parparagraph[$i] = stripFontAndStyle($parparagraph[$i]); } sql_query(INSERT INTO tblArticleParagraph (hostid,artid,sort,options,headline,picurl,paragraph,pictext) VALUES ($session_hostid,$lid,$i,$popt,'$parheadline[$i]','$parpicurl[$i]','$parpara graph[$i]','$parpictext[$i]')); $tmpbody .= $parheadline[$i]; $tmpbody .= ' '; $tmpbody .= $parparagraph[$i]; $tmpbody .= ' '; } sql_query(UPDATE tblArticle SET body='$tmpbody' WHERE id=$lid AND hostid=hostid=$session_hostid); sql_query(DELETE FROM tblArticleParagraph WHERE artid=$lid AND sort=-1 AND hostid=$session_hostid); } if ($special $formid) { # form based article publishing # arnt h, Feb 03 list($tformid,$treplyid) = sql_queryandfetch(SELECT formid,replyid FROM refArticleForm WHERE hostid=$session_hostid AND artid='$saveid' You do not finish the above SQL statement if (!$tformid !$treplyid) { sql_query(INSERT INTO refArticleForm (hostid,artid,formid,replyid) VALUES ($session_hostid,$saveid,$formid,0)); $tformid = $formid; } $surveyid = $tformid; $hostid = $session_hostid; $arntid = $id; $id = $saveid; $arntpublic_userid = $public_userid; $public_userid = 0; include 'include/surveysavereply.inc'; ## perform saving $public_userid = $arntpublic_userid; $id = $arntid; sql_query(UPDATE refArticleForm SET replyid=$thisreplyid WHERE artid=$saveid AND hostid=$session_hostid); $tmp = ''; reset($surveykeyval); foreach ($surveykeyval as $key = $val) { for ($xxi=0; $xxicount($val); $xxi++) { $tmpval = $val[$xxi]; if (!$tmpval) continue; $tmpval = preg_replace('/\|\{.*?\}/','',$tmpval); $lbl = fbq_.$key; $tmp .= $key lbl=\.$$lbl.\$tmpval/$key\r\n; } } # $tmp = 'bodyxml'.$tmp.'/bodyxml'; sql_query(UPDATE tblArticle SET body='$tmp' WHERE id=$saveid AND hostid=$session_hostid); } # Save tblArticleExtension # list($tmp) = sql_queryandfetch(SELECT id FROM tblArticleExtension WHERE artid=$lid AND hostid=$session_hostid); if ($tmp) sql_query(UPDATE tblArticleExtension SET custom1='$custom1',custom2='$custom2',custom3='$custom3',custom4='$custom4' WHERE ar Same here... elseif ($custom1||$custom2||$custom3||$custom4) sql_query(INSERT INTO tblArticleExtension (hostid,artid,custom1,custom2,custom3,custom4) V and here... Those alone will cause a ton of parse errors. if ($hostid==31) echo hrlid2:$lid; ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables changes their values
[snip] I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: if ($hostid==31) echo lid1: $lid; # Paragraphs [/snip] $lid is getting set the first time before the IF statement. From this IF to the last $lid in what you posted I couldn't find anything re-setting $lid. So you must be doing it outside of the code block. What is the initial value of the variable, and what does it change to? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
Thats the strange thing... there IS NO CODE that change the value... And the cut/paste is bad... there is no parse errors and the code snip is only a small part of a scriptfile. - Svein On Tuesday 03 June 2003 15:33, Jay Blanchard wrote: [snip] I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: if ($hostid==31) echo lid1: $lid; # Paragraphs [/snip] $lid is getting set the first time before the IF statement. From this IF to the last $lid in what you posted I couldn't find anything re-setting $lid. So you must be doing it outside of the code block. What is the initial value of the variable, and what does it change to? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
On Tuesday 03 June 2003 15:27, CPT John W. Holmes wrote: On Tuesday 03 June 2003 13:58, Jay Blanchard wrote: [snip] We would have to see some code Jay I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: Either this is a bad cut and paste job or this script will never run because it's full of errors. Either way, if $lid changes, it's because you're changing it. Maybe you have an if($lid = 'value') instead of if($lid Yep, its a bad paste :) The script is error-free... But there is no code that change the variable and it still get changed. Eg. it change from 75497 to 6894 - Svein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
Yep, its a bad paste :) The script is error-free... But there is no code that change the variable and it still get changed. Eg. it change from 75497 to 6894 In order of increasing probability: - you can attribute it to black magic - you've hit upon a php bug - there's something wrong with your code Assume that there's something wrong with your code, you can do one of the following: - step through it with a debugger to see where $lid changes - remove code from it until $lid doesn't change - echo $lid after everything statement/line in your code -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* You may have heard that a dean is to faculty as a hydrant is to a dog. -- Alfred Kahn */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
Cutpaste the code, also file include/surveysavereply.inc. Svein Larsen wrote: On Tuesday 03 June 2003 15:27, CPT John W. Holmes wrote: On Tuesday 03 June 2003 13:58, Jay Blanchard wrote: [snip] We would have to see some code Jay I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: Either this is a bad cut and paste job or this script will never run because it's full of errors. Either way, if $lid changes, it's because you're changing it. Maybe you have an if($lid = 'value') instead of if($lid Yep, its a bad paste :) The script is error-free... But there is no code that change the variable and it still get changed. Eg. it change from 75497 to 6894 - Svein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variables changes their values
I'm getting strange behavior in some of my scripts I just upgraded from 4.3.1 to 4.3.2 and was hoping it would solve the problem. The problem is that variables changes its values from one line og code to another - without specific code that should change the value. Do anybody else had this problem? - Svein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables changes their values
[snip] I'm getting strange behavior in some of my scripts I just upgraded from 4.3.1 to 4.3.2 and was hoping it would solve the problem. The problem is that variables changes its values from one line og code to another - without specific code that should change the value. Do anybody else had this problem? [/snip] We would have to see some code Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
I'm getting strange behavior in some of my scripts I just upgraded from 4.3.1 to 4.3.2 and was hoping it would solve the problem. The problem is that variables changes its values from one line og code to another - without specific code that should change the value. Do anybody else had this problem? The problem is in your code. Show us an example of this problem with your actual code. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables changes their values
On Tuesday 03 June 2003 13:58, Jay Blanchard wrote: [snip] We would have to see some code Jay I'm not able to reproduce this in a short code-snippet. But from the first echo to the last echo $lid change its value: if ($hostid==31) echo lid1: $lid; # Paragraphs # if ($bodytype==1) { sql_query(UPDATE tblArticleParagraph SET sort=-1 WHERE artid=$lid AND hostid=$session_hostid); $tmpbody = ''; for ($i=0; $icount($paragraphs); $i++) { $popt = 1; $popt = $popt | (($parhardoutline[$i]) ? 0x2 : 0); $parpicurl[$i] = preg_replace(/'/s,'',$parpicurl[$i]); $parheadline[$i] = trim($parheadline[$i]); $parpictext[$i] = trim($parpictext[$i]); if ($hostoptions0x80) { # STRICT FONT/STYLE STRIP $parparagraph[$i] = stripFontAndStyle($parparagraph[$i]); } sql_query(INSERT INTO tblArticleParagraph (hostid,artid,sort,options,headline,picurl,paragraph,pictext) VALUES ($session_hostid,$lid,$i,$popt,'$parheadline[$i]','$parpicurl[$i]','$parparagraph[$i]','$parpictext[$i]')); $tmpbody .= $parheadline[$i]; $tmpbody .= ' '; $tmpbody .= $parparagraph[$i]; $tmpbody .= ' '; } sql_query(UPDATE tblArticle SET body='$tmpbody' WHERE id=$lid AND hostid=hostid=$session_hostid); sql_query(DELETE FROM tblArticleParagraph WHERE artid=$lid AND sort=-1 AND hostid=$session_hostid); } if ($special $formid) { # form based article publishing # arnt h, Feb 03 list($tformid,$treplyid) = sql_queryandfetch(SELECT formid,replyid FROM refArticleForm WHERE hostid=$session_hostid AND artid='$saveid' if (!$tformid !$treplyid) { sql_query(INSERT INTO refArticleForm (hostid,artid,formid,replyid) VALUES ($session_hostid,$saveid,$formid,0)); $tformid = $formid; } $surveyid = $tformid; $hostid = $session_hostid; $arntid = $id; $id = $saveid; $arntpublic_userid = $public_userid; $public_userid = 0; include 'include/surveysavereply.inc'; ## perform saving $public_userid = $arntpublic_userid; $id = $arntid; sql_query(UPDATE refArticleForm SET replyid=$thisreplyid WHERE artid=$saveid AND hostid=$session_hostid); $tmp = ''; reset($surveykeyval); foreach ($surveykeyval as $key = $val) { for ($xxi=0; $xxicount($val); $xxi++) { $tmpval = $val[$xxi]; if (!$tmpval) continue; $tmpval = preg_replace('/\|\{.*?\}/','',$tmpval); $lbl = fbq_.$key; $tmp .= $key lbl=\.$$lbl.\$tmpval/$key\r\n; } } # $tmp = 'bodyxml'.$tmp.'/bodyxml'; sql_query(UPDATE tblArticle SET body='$tmp' WHERE id=$saveid AND hostid=$session_hostid); } # Save tblArticleExtension # list($tmp) = sql_queryandfetch(SELECT id FROM tblArticleExtension WHERE artid=$lid AND hostid=$session_hostid); if ($tmp) sql_query(UPDATE tblArticleExtension SET custom1='$custom1',custom2='$custom2',custom3='$custom3',custom4='$custom4' WHERE ar elseif ($custom1||$custom2||$custom3||$custom4) sql_query(INSERT INTO tblArticleExtension (hostid,artid,custom1,custom2,custom3,custom4) V if ($hostid==31) echo hrlid2:$lid; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php