Sesquipedalian
Members-
Posts
90 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Sesquipedalian's Achievements
Member (2/5)
0
Reputation
-
Associative array/multidimensional....help please
Sesquipedalian replied to chito's topic in PHP Coding Help
I'd say it's just a matter of opinion. There's not even that much of a difference in how you'd retrieve the information if the array changed over time... First Array: <?php foreach($products as $product) { echo "Item : " . $product['item'] . "<br />" ."Price : " . $product['price'] . "<br />" ."Shipping : " . $product['shipping']; } ?> Second Array: <?php foreach($products as $item=>product) { echo "Item : " . $item . "<br />" ."Price : " . $product['price'] . "<br />" ."Shipping : " . $product['shipping']; } ?> Looking above, I think I'd more likely use the first array that you posted, just because the code for the foreach looks better and more uniform to me. -
I agree with Cardale. If somehow you can't do that, however, you could use Regex and check if the URL has something like ../something.php.
-
I would use session variables. When they log in you can assign something like $_SESSION['auth'] = 1; And then you could have special code that checks whether or not $_SESSION['auth'] == 1 and make it display different prices accordingly. I'm not exactly sure on the Flash aspect, however.
-
Does $ids actually have a value? Maybe make sure that it's actually passing a variable. Also - you might want to tidy up your code a bit. You have an extra > at the end of your code, and you forgot to use a semicolon ; to end the echo.
-
PHP conditional statement to check value of plugin
Sesquipedalian replied to tracedef's topic in PHP Coding Help
You were close; I corrected your code: <?php if ( lp_tags('id_number') > 0 ): ?> <link rel="stylesheet" type="text/css" media="screen" href="style1.css" /> <?php else: ?> <link rel="stylesheet" type="text/css" href="style2.css" /> <?php endif; ?> You placed a semicolin instead of a colin after the first if, and you needed a colin after the else also. -
You call alert('bla22') in the callback function, so that doesn't get triggered until your file is loaded with $.post. It just keeps going on with the code and then executes the callback function when the file is actually loaded. Why does it matter, though?
-
Your code was written kind of odd, but this is what I think you're asking for: <?php $i=0; foreach($tp as $val) { $SQLQuery[$i] = $val; $i++; } ?> Am I missing a part of what you're looking for?
-
Hello all, I wrote a jQuery / HTML code that seems to work great in Chrome and Firefox, but it doesn't do anything in IE. I use jQuery's animate function to move absolutely positioned ul's and il's. Any idea why it isn't working? jQuery $(document).ready(function() { $("div.links").hover(function() {}, function() { $("li.mainLink").each(function() { $(this).stop().animate({ opacity: 1, }, 100); }); }); $("li.mainLink").hover(function() { $(this).data("hover", "yes"); $(this).css({opacity: 1,}); $("li.mainLink").each(function() { if($(this).data("hover") != "yes") { $(this).animate({ opacity: .4, }, 100); } }); }, function() { $(this).data("hover", "no"); $(this).animate({ opacity: .4, }, 50); }); var leftNum; leftNum = 0; var num; num = -1; $("li.mainLink").each(function() { num++; leftNum = (126*num)+30; $(this).stop().animate({ left: leftNum, },1000); }); }); HTML <div class="bodyWrapper"> <div class="banner"></div> <div class="links"> <ul class="linkWrapper"> <li class="mainLink"><span>Main Link</span></li> <li class="mainLink"><span>Main Link</span></li> <li class="mainLink"><span>Main Link</span></li> <li class="mainLink"><span>Main Link</span></li> <li class="mainLink"><span>Main Link</span></li> <li class="mainLink"><span>Main Link</span></li> <li class="mainLink"><span>Main Link</span></li> </ul> </div> <div class="mainWrapper"> </div> <div class="bottomShadow"></div> <div class="leftShadow"></div> <div class="rightShadow"></div> <div class="bottomLeft"></div> <div class="bottomRight"></div> </div> CSS (if needed) <style type="text/css" > .bodyWrapper { width:947px; text-align:left; margin:0 auto; height:400px; position:relative; } body { text-align:center; background:url("bg.jpg"); font-family:"Helvetica Neue"; } .banner { background:url("banner.jpg"); width:100%; height:113px; position:absolute; top:0; } .leftShadow { background:url("leftShadow.jpg"); height:100%; width:29px; position:absolute; top:0; left:0; } .rightShadow { background:url("rightShadow.jpg"); height:100%; width:29px; position:absolute; top:0; right:0; } .bottomShadow { background:url("bottomShadow.jpg"); height:20px; width:100%; position:absolute; bottom:0; } .bottomLeft { background:url("bottomLeft.jpg"); height:73px; width:84px; position:absolute; bottom:-22; left:-13; } .bottomRight { background:url("bottomRight.jpg"); height:54px; width:59px; position:absolute; bottom:-15; right:-5; } .links { background:url("linksBg.jpg"); height:34px; width:100%; position:absolute; top:113px; } .mainWrapper { height:100%; width:100%; background-color:white; } li.mainLink{ background:url("linkNormal.jpg"); height:30px; width:131px; text-align:center; position:absolute; top:2px; cursor:pointer; } li.mainLink > span { position:relative; top:16%; font-size:13px; color:#76413d; } ul { list-style-type:none; } </style> Thanks for your help, - Sesq
-
Why does this only work on firefox? Internet explorer seems to have errors with it: function list(what, how) { if (how == 'out') { what = document.getElementById(what); for (a in what.getElementsByClassName('sub')) { if (a >= 0) { what.getElementsByClassName('sub')[a].setAttribute('style', 'display:block;'); } } } else if (how == 'in') { what = document.getElementById(what); for (a in what.getElementsByClassName('sub')) { if (a >= 0) { what.getElementsByClassName('sub')[a].setAttribute('style', 'display:none;'); } } } } Thanks for your help, - Adam
-
You could also get fancy and use AJAX if for some reason you don't want to have the page reload when you submit your data.
-
If you dont know something like || or manipulating GET variables you should probably take a look at a beginner PHP tutorial -- it'll make the things you're trying to do much easier.
-
Can you post all of your code? It'd probably make it easier to be able to understand whats going wrong.
-
Something similar should also suffice: <? $sql="select image from inputinfo where id='$id'"; $rez=mysql_query($sql,$dblnk); if ($rez) { $row=mysql_fetch_array($rez); echo "<img src='admin/{$row['image']}' />"; } ?>
-
Hey everyone, If this doesn't go here, let me know... I'm trying to create a package for VB.NET for the JS eval function, and in doing so I'm writing my code in JS (obviously)... What I was wondering is, do you know how to compile a .js file into a .dll file? I know how I could do it on the .NET command prompt, but I have no idea how to get there. I have not been able to find any info on this on the net... Thanks for your help - Adam