Jump to content

Skipjackrick

Members
  • Posts

    196
  • Joined

  • Last visited

    Never

Everything posted by Skipjackrick

  1. Nah, its not that... It has something to do with the switch statement I think. switch($rowCount) { case 1: $query_speciestotals = "SELECT angler, species_id, yyyy SUM(IF(species_id=1,1,0)) AS speciesA, SUM(IF(angler=1,1,0)) AS species_total FROM submit WHERE angler=1 GROUP BY species_id AND yyyy ORDER BY yyyy"; $speciestotals = mysql_query($query_speciestotals) or die(mysql_error());
  2. I know this is against the rules to put a post to the top but i can't edit the post. i forgot to add that the above code is inside a switch statement. i think that's part of it. $queryspecies = "SELECT * FROM submit WHERE angler=$angler_id GROUP BY species_id"; $resultspecies = mysql_query($queryspecies) or die(mysql_error()); // get count of how many rows $rowCount = mysql_num_rows($resultspecies); // let's get the results into an array while($row = mysql_fetch_assoc($resultspecies)) $results[] = $row; switch($rowCount) { case 1: $query_speciestotals = "SELECT angler, species_id, yyyy SUM(IF(species_id=1,1,0)) AS speciesA, SUM(IF(angler=1,1,0)) AS species_total FROM submit WHERE angler=1 GROUP BY species_id AND yyyy ORDER BY yyyy"; $speciestotals = mysql_query($query_speciestotals) or die(mysql_error()); while($row = mysql_fetch_array($speciestotals)) { $yyyy = $row['yyyy']; $speciesA = $row['speciesA']; $species_total = $row['species_total']; $species_totals_row .=<<<EOD <tr> <td align='center'>$yyyy</td> <td align='center'>$speciesA</td> <td align='center'>$species_total</td> </tr> EOD; } more code past this irrelevant
  3. I can't figure this one out? Does anything scream out at you guys? You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUM(IF(species_id=1,1,0)) AS speciesA, SUM(IF(angler=1' at line 3 $query_speciestotals = "SELECT angler, species_id, yyyy SUM(IF(species_id=1,1,0)) AS speciesA, SUM(IF(angler=1,1,0)) AS species_total FROM submit WHERE angler=1 GROUP BY species_id AND yyyy ORDER BY yyyy"; $speciestotals = mysql_query($query_speciestotals) or die(mysql_error()); while($row = mysql_fetch_array($speciestotals)) { $yyyy = $row['yyyy']; $speciesA = $row['speciesA']; $species_total = $row['species_total']; $species_totals_row .=<<<EOD <tr> <td align='center'>$yyyy</td> <td align='center'>$speciesA</td> <td align='center'>$species_total</td> </tr> EOD; }
  4. I put a form validation code in the head of my documents but my select options have the value=null for the first value and some have value=0....Therefore, Is it possible to set the "obj.value" to == 0 AND null ? That way it will not let the user continue with a null value also. function formCheck(formobj){ // Enter name of mandatory fields var fieldRequired = Array("angler", "species_id", "mm", "dd"); // Enter field description to appear in the dialog box var fieldDescription = Array("Angler", "Species Name", "Month", "Day"); // dialog message var alertMsg = "Please complete the following fields:\n"; var l_Msg = alertMsg.length; for (var i = 0; i < fieldRequired.length; i++){ var obj = formobj.elements[fieldRequired[i]]; if (obj){ switch(obj.type){ case "select-one": if (obj.value == 0){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "select-multiple": if (obj.selectedIndex == -1){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "text": if (obj.value == ""){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; default: } if (obj.type == undefined){ var blnchecked = false; for (var j = 0; j < obj.length; j++){ if (obj[j].checked){ blnchecked = true; } } if (!blnchecked){ alertMsg += " - " + fieldDescription[i] + "\n"; } } } } if (alertMsg.length == l_Msg){ return true; }else{ alert(alertMsg); return false; } }
  5. WOW! That is alot easier on the eyes... Thanks! I just don't have enough knowledge about all of the different functions to use. Thanks!!!
  6. Well, its a fix for the rest of my code in the page. If there are only three rows in the query then I get. $results[0]['angler'] = 1 $results[1]['angler'] = 2 $results[2]['angler'] = 3 But I need to set the following variables to something otherwise it leaves my other queries empty and that won't work.....Therefore...I just set them as some other value that will make do. $results[3]['angler'] = 0 $results[4]['angler'] = 0
  7. I still get a fatal error and This is the only code I typed into the page. Is this a syntax issue or something else? Not sure? Fatal error: Can't use function return value in write context in <?php $querymembers = "SELECT * FROM anglers WHERE team_id=$teamvar GROUP BY angler LIMIT 5"; $teamanglers = mysql_query($querymembers) or die(mysql_error()); if (mysql_num_rows($teamanglers)=3) { while($row = mysql_fetch_assoc($teamanglers)) { $results[] = $row; } $results[3]['angler'] = 0; $results[3]['handle'] = 'vacant'; $results[3]['name'] = 'vacant'; $results[3]['kayak'] = 'vacant'; $results[4]['angler'] = 0; $results[4]['handle'] = 'vacant'; $results[4]['name'] = 'vacant'; $results[4]['kayak'] = 'vacant'; } elseif(mysql_num_rows($teamanglers)=4){ while($row = mysql_fetch_assoc($teamanglers)) { $results[] = $row; } $results[4]['angler'] = 0; $results[4]['handle'] = 'vacant'; $results[4]['name'] = 'vacant'; $results[4]['kayak'] = 'vacant'; } else { while($row = mysql_fetch_assoc($teamanglers)) { $results[] = $row; } } ?> [code]
  8. Ok, So I am trying to set some if/else statements with several conditions and I am getting a fatal error. Example, IF num_rows = 3 {execute code 1} else { IF num_rows = 4 {execute code 2} } else { {execute code 3} } } Anyways, maybe its possible....here is what I've got so far.. <?php $querymembers = "SELECT * FROM anglers WHERE team_id=$teamvar GROUP BY angler LIMIT 5"; $teamanglers = mysql_query($querymembers) or die(mysql_error()); if (mysql_num_rows($teamanglers) = 3) { while($row = mysql_fetch_assoc($teamanglers)) { $results[] = $row; } $results[3]['angler'] = 0; $results[3]['handle'] = vacant; $results[3]['name'] = vacant; $results[3]['kayak'] = vacant; $results[4]['angler'] = 0; $results[4]['handle'] = vacant; $results[4]['name'] = vacant; $results[4]['kayak'] = vacant; } else { if (mysql_num_rows($teamanglers) = 4) { while($row = mysql_fetch_assoc($teamanglers)) { $results[] = $row; } $results[4]['angler'] = 0; $results[4]['handle'] = vacant; $results[4]['name'] = vacant; $results[4]['kayak'] = vacant; } else { while($row = mysql_fetch_assoc($teamanglers)) { $results[] = $row; } } } ?>
  9. Well, I abandoned the CSS because of an issue I just couldn't figure out and went back to the good ole javascript. To save myself html markup and time I just did a quick search and found one to use. However... Why does IE7 have the LAG? It is stuck loading something or doing something behind the scenes. Then if you right click the page it will begin working. Anybody know? here is a link to my page. http://extremecoast.com/KW09/layoutdoc2.php Maybe a little code for the gurus...The JS I am using. //If the browser is W3 DOM compliant, execute setImageSwaps function if (document.getElementsByTagName && document.getElementById) { if (window.addEventListener) window.addEventListener('load', setImageSwaps, false); else if (window.attachEvent) window.attachEvent('onload', setImageSwaps); } //When document loads, apply the prepareImageSwap function to various images with our desired settings function setImageSwaps() { //Hover with restore, most basic usage - for any image in document.body that are not yet processed (function accepts elements,too) prepareImageSwap(document.body); //Note that once an image is processed, it wont be processed again, so you should set more specific images first, e.g. document.body, as it is the grand //container, has to be processed last. } //The following is the function that do the actual job function prepareImageSwap(elem,mouseOver,mouseOutRestore,mouseDown,mouseUpRestore,mouseOut,mouseUp) { //Do not delete these comments. //Non-Obtrusive Image Swap Script by Hesido.com //V1.1 //Attribution required on all accounts if (typeof(elem) == 'string') elem = document.getElementById(elem); if (elem == null) return; var regg = /(.*)(_nm\.)([^\.]{3,4})$/ var prel = new Array(), img, imgList, imgsrc, mtchd; imgList = elem.getElementsByTagName('img'); for (var i=0; img = imgList[i]; i++) { if (!img.rolloverSet && img.src.match(regg)) { mtchd = img.src.match(regg); img.hoverSRC = mtchd[1]+'_hv.'+ mtchd[3]; img.outSRC = img.src; if (typeof(mouseOver) != 'undefined') { img.hoverSRC = (mouseOver) ? mtchd[1]+'_hv.'+ mtchd[3] : false; img.outSRC = (mouseOut) ? mtchd[1]+'_ou.'+ mtchd[3] : (mouseOver && mouseOutRestore) ? img.src : false; img.mdownSRC = (mouseDown) ? mtchd[1]+'_md.' + mtchd[3] : false; img.mupSRC = (mouseUp) ? mtchd[1]+'_mu.' + mtchd[3] : (mouseOver && mouseDown && mouseUpRestore) ? img.hoverSRC : (mouseDown && mouseUpRestore) ? img.src : false; } if (img.hoverSRC) {preLoadImg(img.hoverSRC); img.onmouseover = imgHoverSwap;} if (img.outSRC) {preLoadImg(img.outSRC); img.onmouseout = imgOutSwap;} if (img.mdownSRC) {preLoadImg(img.mdownSRC); img.onmousedown = imgMouseDownSwap;} if (img.mupSRC) {preLoadImg(img.mupSRC); img.onmouseup = imgMouseUpSwap;} img.rolloverSet = true; } } function preLoadImg(imgSrc) { prel[prel.length] = new Image(); prel[prel.length-1].src = imgSrc; } } function imgHoverSwap() {this.src = this.hoverSRC;} function imgOutSwap() {this.src = this.outSRC;} function imgMouseDownSwap() {this.src = this.mdownSRC;} function imgMouseUpSwap() {this.src = this.mupSRC;} HTML markup example...nothing to it really? <a href="http://www.extremecoast.com"><img src="http://www.extremecoast.com/KW09/layout/menu1_nm.jpg" border="0" alt="" /></a> <a href="http://www.extremecoast.com"><img src="http://www.extremecoast.com/KW09/layout/menu2_nm.jpg" border="0" alt="" /></a> <a href="http://www.extremecoast.com"><img src="http://www.extremecoast.com/KW09/layout/menu3_nm.jpg" border="0" alt="" /></a>
  10. This is way weird however I found the glitch. I cleared my browser cache and browsing history and it worked perfect for Firefox 3.0.5 also. I did not observe any differences when switching off javascript? However, go to this link.... http://www.extremecoast.com/ And then go to my test link http://www.extremecoast.com/KW09/test.php You see that it doesn't work. But, if you clear your browsing history and then re-check the "test" link again....Everything works great!!!!!!! Is it something in my main page code that is doing it? <SCRIPT LANGUAGE="JavaScript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin image1 = new Image();image1.src = "http://extremecoast.com/layout/v2/menu1on.jpg"; image2 = new Image();image2.src = "http://extremecoast.com/layout/v2/menu2on.jpg"; image3 = new Image();image3.src = "http://extremecoast.com/layout/v2/menu3on.jpg"; image4 = new Image();image4.src = "http://extremecoast.com/layout/v2/menu4on.jpg"; image5 = new Image();image5.src = "http://extremecoast.com/layout/v2/menu5on.jpg"; image6 = new Image();image6.src = "http://extremecoast.com/layout/v2/menu6on.jpg"; image7 = new Image();image7.src = "http://extremecoast.com/layout/v2/menu7on.jpg"; image8 = new Image();image8.src = "http://extremecoast.com/layout/v2/2menu1on.jpg"; image9 = new Image();image9.src = "http://extremecoast.com/layout/v2/2menu2on.jpg"; image10 = new Image();image10.src = "http://extremecoast.com/layout/v2/2menu3on.jpg"; image11 = new Image();image11.src = "http://extremecoast.com/layout/v2/2menu4on.jpg"; image12 = new Image();image12.src = "http://extremecoast.com/layout/v2/2menu5on.jpg"; image13 = new Image();image13.src = "http://extremecoast.com/layout/v2/2menu6on.jpg"; image14 = new Image();image14.src = "http://extremecoast.com/layout/v2/2menu7on.jpg"; // End --> </script> <script defer type="text/javascript" src="pngfix.js"></script> <body> <a href="http://extremecoast.com" onmouseover="image1.src='http://extremecoast.com/layout/v2/menu1on.jpg';" onmouseout="image1.src='http://extremecoast.com/layout/v2/menu1onon.jpg';"><img name="image1" src="http://extremecoast.com/layout/v2/menu1onon.jpg" border=0></a><a href="http://extremecoast.com/reports/reports.php" onmouseover="image2.src='http://extremecoast.com/layout/v2/menu2on.jpg';" onmouseout="image2.src='http://extremecoast.com/layout/v2/menu2off.jpg';"><img name="image2" src="http://extremecoast.com/layout/v2/menu2off.jpg" border=0></a><a href="http://extremecoast.com/Kayak_Wars/index.php" onmouseover="image3.src='http://extremecoast.com/layout/v2/menu3on.jpg';" onmouseout="image3.src='http://extremecoast.com/layout/v2/menu3off.jpg';"><img name="image3" src="http://extremecoast.com/layout/v2/menu3off.jpg" border=0></a><a href="http://extremecoast.com/phpBB3/index.php" onmouseover="image4.src='http://extremecoast.com/layout/v2/menu4on.jpg';" onmouseout="image4.src='http://extremecoast.com/layout/v2/menu4off.jpg';"><img name="image4" src="http://extremecoast.com/layout/v2/menu4off.jpg" border=0></a><a href="http://extremecoast.com/multimedia/multimedia.php" onmouseover="image5.src='http://extremecoast.com/layout/v2/menu5on.jpg';" onmouseout="image5.src='http://extremecoast.com/layout/v2/menu5off.jpg';"><img name="image5" src="http://extremecoast.com/layout/v2/menu5off.jpg" border=0></a><a href="http://extremecoast.com/contest.php" onmouseover="image6.src='http://extremecoast.com/layout/v2/menu6on.jpg';" onmouseout="image6.src='http://extremecoast.com/layout/v2/menu6off.jpg';"><img name="image6" src="http://extremecoast.com/layout/v2/menu6off.jpg" border=0></a><a href="http://extremecoast.com/contact.php" onmouseover="image7.src='http://extremecoast.com/layout/v2/menu7on.jpg';" onmouseout="image7.src='http://extremecoast.com/layout/v2/menu7off.jpg';"><img name="image7" src="http://extremecoast.com/layout/v2/menu7off.jpg" border=0></a><BR> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="5" ALIGN="center" WIDTH="765"> <TR> Rest of Page past this point excluded.
  11. Wow?? hmmmm....Do you think it has something to do with the fact that the images are .PNG ??? I've had issues with .PNG images disappearing and there was a javascript png fix I think? I just downloaded FF 3.0.6 and it works great. FF 3.0.5 it doesn't work.... I may go to the javascript forum for some help. Thanks for the info fellas!
  12. LMAO!! Are you serious? What could be causing that.... I am totally flabberghasted!
  13. Well, the images aren't displayed in firefox. Basically, I get a blank screen. I figured this might be a common problem with FF 3. If you have IE you can see what it is supposed to look like at the following link. http://www.extremecoast.com/KW09/test.php
  14. Ok, I just don't understand why this doesn't work? The code is so simple? The following works with Internet Explorer just fine. But in FF 3 its a no go. Anybody know why? Basic HTML Code Link if you want to see in FF 3 or IE --> http://www.extremecoast.com/KW09/test.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="http://www.extremecoast.com/KW09/layout/kayakwars.css" type="text/css" /> </head> <body> <a href="http://www.extremecoast.com" class="rollover1"></a> <a href="http://www.extremecoast.com" class="rollover2"></a> <a href="http://www.extremecoast.com" class="rollover3"></a> <a href="http://www.extremecoast.com" class="rollover4"></a> <a href="http://www.extremecoast.com" class="rollover5"></a> <a href="http://www.extremecoast.com" class="rollover6"></a> <a href="http://www.extremecoast.com" class="rollover7"></a> </body> </html> My CSS.....I Don't think there are any errors???? @charset "utf-8"; /* CSS Document */ /******************************************** LAYOUT ********************************************/ body { background-color: #000000; font: 100% Verdana, Tahoma, arial, sans-serif; color: #FFFFFF; text-align: center; } p { font: 100%/1.5em Verdana, Tahoma, arial, sans-serif; } /* Menu rollover */ a.rollover1:link { display: block; width: 88px; height: 20px; background: url("http://www.extremecoast.com/KW09/layout/menu1.PNG") 0 0 no-repeat; text-decoration: none; } a.rollover1:hover { background-position: -88px 0; } a.rollover2:link { display: block; width: 91px; height: 20px; background: url("http://www.extremecoast.com/KW09/layout/menu2.PNG") 0 0 no-repeat; text-decoration: none; } a.rollover2:hover { background-position: -91px 0; } a.rollover3:link { display: block; width: 126px; height: 20px; background: url("http://www.extremecoast.com/KW09/layout/menu3.PNG") 0 0 no-repeat; text-decoration: none; } a.rollover3:hover { background-position: -126px 0; } a.rollover4:link { display: block; width: 86px; height: 20px; background: url("http://www.extremecoast.com/KW09/layout/menu4.PNG") 0 0 no-repeat; text-decoration: none; } a.rollover4:hover { background-position: -86px 0; } a.rollover5:link { display: block; width: 126px; height: 20px; background: url("http://www.extremecoast.com/KW09/layout/menu5.PNG") 0 0 no-repeat; text-decoration: none; } a.rollover5:hover { background-position: -126px 0; } a.rollover6:link { display: block; width: 100px; height: 20px; background: url("http://www.extremecoast.com/KW09/layout/menu6.PNG") 0 0 no-repeat; text-decoration: none; } a.rollover6:hover { background-position: -100px 0; } a.rollover7:link { display: block; width: 148px; height: 20px; background: url("http://www.extremecoast.com/KW09/layout/menu7.PNG") 0 0 no-repeat; text-decoration: none; } a.rollover7:hover { background-position: -148px 0; } /* links */ a.kwmenu:link { font-size: 11px; color: #f6ff91; text-decoration: none; } a.kwmenu:active { font-size: 11px; color: #f6ff91; text-decoration: none } a.kwmenu:visited { font-size: 11px; color: #f6ff91; text-decoration: none } a.kwmenu:hover { font-size: 11px; color: #86a0f6; text-decoration: none } /* headers */ h1, h2, h3 { font-family: Verdana, Tahoma, Sans-serif; } h1 { font-size: 150%; font-weight: normal; color: #FFFFFF; } h2 { font-size: 140%; text-transform: uppercase; color: #FFFFFF; } h3 { font-size: 120%; color: #FFFFFF; } /* start - table */ .kwmenutable { border-color:#999999 border: solid border-width:thick } table { text-align:center; } th strong { color: #fff; } th { font-family: Verdana; font-size: 70%; background: none; height: 29px; text-align: center; } tr { text-align:center; } td { font-family: Verdana; font-size: 70%; text-align: center; } /* end - table */ /* form elements */ form { margin:10px; padding: 0 10px; background-color: #FFF; } label { display:block; font-weight:bold; margin:5px 0; } input { padding:2px; border:1px solid #eee; font: normal 1em Verdana, sans-serif; color:#777; } textarea { width:400px; padding:2px; font: normal 1em Verdana, sans-serif; border:1px solid #eee; height:100px; display:block; color:#777; } input.button { font: bold 12px Arial, Sans-serif; height: 24px; margin: 0; padding: 2px 3px; color: #FFF; border: none; background-color: #003399; background-image: url(button-bg.jpg); background-repeat: repeat-x; background-position: 0 0; }
  15. Can anybody tell me why my onmouseover etc is not working? Here is the page. (Working with CSS to get layout correct...ignore alignment issues..LOL) http://www.extremecoast.com/KW09/layoutdoc2.php A short section of code where I believe the problem is. <script type="text/javascript"> image1 = new Image();image1.src = "http://extremecoast.com/layout/v2/menu1on.jpg"; image2 = new Image();image2.src = "http://extremecoast.com/layout/v2/menu2on.jpg"; image3 = new Image();image3.src = "http://extremecoast.com/layout/v2/menu3on.jpg"; image4 = new Image();image4.src = "http://extremecoast.com/layout/v2/menu4on.jpg"; image5 = new Image();image5.src = "http://extremecoast.com/layout/v2/menu5on.jpg"; image6 = new Image();image6.src = "http://extremecoast.com/layout/v2/menu6on.jpg"; image7 = new Image();image7.src = "http://extremecoast.com/layout/v2/menu7on.jpg"; image8 = new Image();image8.src = "http://extremecoast.com/layout/v2/2menu1on.jpg"; image9 = new Image();image9.src = "http://extremecoast.com/layout/v2/2menu2on.jpg"; image10 = new Image();image10.src = "http://extremecoast.com/layout/v2/2menu3on.jpg"; image11 = new Image();image11.src = "http://extremecoast.com/layout/v2/2menu4on.jpg"; image12 = new Image();image12.src = "http://extremecoast.com/layout/v2/2menu5on.jpg"; image13 = new Image();image13.src = "http://extremecoast.com/layout/v2/2menu6on.jpg"; image14 = new Image();image14.src = "http://extremecoast.com/layout/v2/2menu7on.jpg"; </script> <script src="http://www.extremecoast.com/KW09/AC_RunActiveContent.js" type="text/javascript"></script> </head> <body> <a href="http://extremecoast.com"><img src="http://www.extremecoast.com/layout/v2/ecpp.png" border="0" align="middle" alt="" /></a> <table border="2" cellspacing="0" cellpadding="0" align="center" width="765" bgcolor="#000000" > <tr> <td><script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','765','height','200','pluginspage','http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash','src','http://extremecoast.com/layout/v2/kayakwars09banner','wmode','transparent','allowscriptaccess','always','movie','http://www.extremecoast.com/layout/v2/kayakwars09banner','bgcolor','#000000','quality','high' ); //end AC code </script> <br /> <a href="http://extremecoast.com" onmouseover="image1.src='http://extremecoast.com/layout/v2/menu1on.jpg';" onmouseout="image1.src='http://extremecoast.com/layout/v2/menu1off.jpg';"> <img name="image1" src="http://extremecoast.com/layout/v2/menu1off.jpg" border="0" alt="" /> </a> <a href="http://extremecoast.com/reports/reports.php" onmouseover="image2.src='http://extremecoast.com/layout/v2/menu2on.jpg';" onmouseout="image2.src='http://extremecoast.com/layout/v2/menu2off.jpg';"> <img name="image2" src="http://extremecoast.com/layout/v2/menu2off.jpg" border="0" alt="" /> </a> <a href="http://extremecoast.com/Kayak_Wars/index.php" onmouseover="image3.src='http://extremecoast.com/layout/v2/menu3on.jpg';" onmouseout="image3.src='http://extremecoast.com/layout/v2/menu3onon.jpg';"> <img name="image3" src="http://extremecoast.com/layout/v2/menu3onon.jpg" border="0" alt="" /> </a> <a href="http://extremecoast.com/phpBB3/index.php" onmouseover="image4.src='http://extremecoast.com/layout/v2/menu4on.jpg';" onmouseout="image4.src='http://extremecoast.com/layout/v2/menu4off.jpg';"> <img name="image4" src="http://extremecoast.com/layout/v2/menu4off.jpg" border="0" alt="" /> </a> <a href="http://extremecoast.com/multimedia/multimedia.php" onmouseover="image5.src='http://extremecoast.com/layout/v2/menu5on.jpg';" onmouseout="image5.src='http://extremecoast.com/layout/v2/menu5off.jpg';"> <img name="image5" src="http://extremecoast.com/layout/v2/menu5off.jpg" border="0" alt="" /> </a> <a href="http://extremecoast.com/contest.php" onmouseover="image6.src='http://extremecoast.com/layout/v2/menu6on.jpg';" onmouseout="image6.src='http://extremecoast.com/layout/v2/menu6off.jpg';"> <img name="image6" src="http://extremecoast.com/layout/v2/menu6off.jpg" border="0" alt="" /> </a> <a href="http://extremecoast.com/contact.php" onmouseover="image7.src='http://extremecoast.com/layout/v2/menu7on.jpg';" onmouseout="image7.src='http://extremecoast.com/layout/v2/menu7off.jpg';"> <img name="image7" src="http://extremecoast.com/layout/v2/menu7off.jpg" border="0" alt="" /> </a> <br />
  16. I am trying to use a variable from a query result in another query. First I set the variables in an array. $querymembers = "SELECT angler, team_id FROM anglers WHERE team_id=1 GROUP BY angler LIMIT 5"; $teamanglers = mysql_query($querymembers) or die(mysql_error()); while($row = mysql_fetch_assoc($teamanglers)) { $results[] = $row; } I know for a fact that this $results[0]['angler']; will output "1" which is what I want. However, in the second query I get the following error. Parse error: syntax error, unexpected T_VARIABLE What is my problem? Besides being lazy....HAHA $query_anglertotals = "SELECT species_id, SUM(IF(angler="$results[0]['angler']",1,0)) AS anglerA, SUM(IF(angler="$results[0]['angler']",1,0)) AS anglerB, SUM(IF(angler="$results[0]['angler']",1,0)) AS anglerC, SUM(IF(angler="$results[0]['angler']",1,0)) AS anglerD, SUM(IF(angler="$results[0]['angler']",1,0)) AS anglerE FROM submit WHERE team_id=1 GROUP BY species_id ORDER BY species_id"; $anglertotals = mysql_query($query_anglertotals) or die(mysql_error());
  17. I am using the "opendir" to open pics from a particular directory. I want to put a variable inside the directory and it is not working. The following code gives me this error. Any ideas around this? Warning: opendir(/home/mysite/public_html/$team_name/pics/) [function.opendir]: failed to open dir: No such file or directory <?php if ($handle = opendir('/home/mysite/public_html/$team_name/pics/')) { while (false !== ($file = readdir($handle))) { if (preg_match("/\.(jpg|png|jpeg)$/i", $file)) { echo "<a href='$file' onclick='return hs.expand(this)' class='highslide'>\n"; echo "<img src='show_image.php?filename=$file&width=100&height=100' alt=''/>\n"; echo "</a>\n"; } } closedir($handle); } ?>
  18. Ah, thanks for the help. Yes, I will only be passing numeric Id's. This will make it easy.
  19. Thanks! Worked like a champ! As I was doing some google searches I read a few things about SQL injection by passing variables through URL's? How can I protect against this? The material I was reading didn't explain it very well.
  20. I am passing a variable through a URL and I want to use the variable in a query. However it doesn't work. Here is an example link that holds the variable. http://www.mysite.com/teampage.php?team_idvar=1 This is what my query looks like. (Code below) I used..... $_REQUEST['team_idvar'] Is the correct? When I put the actual team_id it works so i know the rest of my code is good. I get this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING <?php $query_anglertotals = "SELECT species_id, SUM(IF(angler='1',1,0)) AS anglerA, SUM(IF(angler='2',1,0)) AS anglerB, SUM(IF(angler='Curmit',1,0)) AS anglerC, SUM(IF(angler='Old Salt',1,0)) AS anglerD, SUM(IF(angler='3',1,0)) AS anglerE, SUM(IF(team_id=1,1,0)) AS teamtotal FROM submit WHERE species_id<25 AND yyyy=2008 AND team_id=$_REQUEST['team_idvar'] GROUP BY species_id ORDER BY species_id"; $anglertotals = mysql_query($query_anglertotals) or die(mysql_error()); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.