Search the Community
Showing results for tags 'undefined variables'.
-
Hi I am hoping someone can help. My hosting company has just moved my website to a different server, and I noticed that it was giving me blank pages, I added in some debug and now I am getting undefined variable errors and I don't know why or how to fix it. The Page which has broken currently gets its information from the database from the url. RewriteRule ^reviews/([^/]*)\/$ /bingosite.php?h1=$1 [L] The code in the broken page that is throwing out undefined variable errors is the following: <? $query = mysql_query("SELECT * FROM link where linktype='bingo' and h1 ='".StripUrl101(ucwords($h1))."'"); { while($row =mysql_fetch_assoc($query)) extract($row);?> <? if ($linkType=="bingo") { ?> <?php echo "$h1"; ?> <? } } ?> I have used this code for years so it could be that it is old but as I only know basic PHP I am very stuck and the hosting company isn't being very helpful. Just to add if I write <? $query = mysql_query("SELECT * FROM link where linktype='bingo' and h1 ='Quick Bingo'"); { while($row =mysql_fetch_assoc($query)) extract($row);?> The results for Quick Bingo appear on the page. However it needs to work dynamically like it was doing before. If anyone can help it would be appreciated. Thanks Rachael
-
I recently filled out a job application for a web developer position. In addition to the usual 'tell us about yourself' questions, I was presented with this one. After searching the web and hacking at it for nearly an hour. I just punched in 5. I'm sure it's wrong. Anyway, I was wondering if someone could give me some clarification on what is happening here: <?php /* What value should you replace the '?' with to make the output read 10? */ var x = 6; var y = 4; var a = function(b) { return function© { return y + b + c; } }; x = 2; y = 5; var fn = a(x); x = 1; y = 3; var unknown = ?; console.log(fn(unknown));* ?> Am I reading correctly that the value of var a is equal to the value returned by function(b) which is equal to the value returned by function© which is y + b + c? I concluded that the value of var a = 4 + 2b + 2c. But since var b and var c are not defined how would I go about getting a strictly numeric value as output? Pardon my ignorance, but I have faced questions like this for other job apps and I am tired of staring at the screen like an idiot! Any clarification would be greatly appreciated!