yami007 Posted December 19, 2011 Share Posted December 19, 2011 I just moved my code from Appserv to EasyPHP and it gave me this error, it was working fine on Appserv...what's with easyPHP ?? Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/ Share on other sites More sharing options...
floridaflatlander Posted December 19, 2011 Share Posted December 19, 2011 Where is the variable used? On submits I use if (issest($_POST(['stuff'])) or you can go $var = FALSE; or $var1 =$var2 = FALSE; or = ''; PS You're getting it because you have more sensitive error reporting now. Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299503 Share on other sites More sharing options...
yami007 Posted December 19, 2011 Author Share Posted December 19, 2011 it's in a WHILE while( $data = mysql_fetch_array($result) ) i called it => $data['id']...and it won't work, it just keeps bringing that error. Will this $var = false work ? Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299507 Share on other sites More sharing options...
Pikachu2000 Posted December 19, 2011 Share Posted December 19, 2011 What is the actual error message, and the relevant code? Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299510 Share on other sites More sharing options...
yami007 Posted December 19, 2011 Author Share Posted December 19, 2011 it's as simple as this: <div id="cours"> <div class="title"><h3>Semestre 1</h3></div> <div id="Sem1"> <?php $query = "SELECT * FROM ce_cours ";//ORDER BY nom"; $result = mysql_query($query) or die(mysql_error()); $row = 0; ?> <table border="0" width="95%" height="40%" cellpadding="0" cellspacing="0"> <tr> <? while( $cours = mysql_fetch_array($result) ){ $row++; ?> <td valign="top"> <h4><?php echo $cours['nom']; ?></h4> <?php $query2 = "SELECT * FROM ce_cour_chap WHERE cour_id=".$cours['cid']; $result2 = mysql_query($query2); while( $chapitre = mysql_fetch_array($result2) ){ ?> <a href="<?php echo $chapitre['chid']; ?>"><?php echo $chapitre['nom']; ?></a><br /> <? } ?> </td> <?php if ( $row%2==o ) { echo '</tr><tr>'; } } ?> </tr> </table> </div> </div> I just cant tell what's wrong here ! Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299518 Share on other sites More sharing options...
Pikachu2000 Posted December 19, 2011 Share Posted December 19, 2011 And what is the actual error message? Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299520 Share on other sites More sharing options...
ManiacDan Posted December 19, 2011 Share Posted December 19, 2011 The word "variable" doesn't exist in your code. The only thing that can possibly help us (and you) is the actual error message. Not a summary, not a paraphrase, the error itself. Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299521 Share on other sites More sharing options...
Drummin Posted December 19, 2011 Share Posted December 19, 2011 Where is $cours['nom'] defined? Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299522 Share on other sites More sharing options...
mikosiko Posted December 19, 2011 Share Posted December 19, 2011 <? while( $cours = mysql_fetch_array($result) ){ $row++; ?> replace the short tags for the long ones <php? while( $cours = mysql_fetch_array($result) ){ $row++; ?> Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299523 Share on other sites More sharing options...
Pikachu2000 Posted December 19, 2011 Share Posted December 19, 2011 One little thing I noticed is here: if ( $row%2==o ) { The result of $row modulus 2 will never equal the letter o. Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299524 Share on other sites More sharing options...
yami007 Posted December 19, 2011 Author Share Posted December 19, 2011 hey thanks Guys...the error was in <? as Mikosiko said...and the Pikachu2000 mentioned too...for the latter i think i mistook 0 with o...I sort of do that everytime Quote Link to comment https://forums.phpfreaks.com/topic/253508-notice-undefined-variable-variable/#findComment-1299531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.