
SaturdayNightSpecial
Members-
Posts
37 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
SaturdayNightSpecial's Achievements

Newbie (1/5)
0
Reputation
-
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
Holy Crap, it was a display problem. It wasn't the div width, it was the height! It must have been right on the edge of go, no go. Thanks for the help, sorry to put you through it for nothing. -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
Yep, It's got to be some kind of display problem. I'll try working with that some more but I can't figure out what in the world it could be since there's plenty of room in the div. -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
I also just tried it as a string for the heck of it and still got the same result. Here's what I used: <?php $saturday= "Saturday"; if ($row_rs_track_details['fri']=="Y") { echo "Friday"; } if ($row_rs_track_details['sat']=="Y") { echo $saturday; } if ($row_rs_track_details['sun']=="Y") { echo "Sunday"; } if ($row_rs_track_details['mon']=="Y") { echo "Monday"; } if ($row_rs_track_details['tues']=="Y") { echo "Tuesday"; } if ($row_rs_track_details['wed']=="Y") { echo "Wednesday"; } if ($row_rs_track_details['thur']=="Y") { echo "Thursday"; } ?> -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
I just tried surrounding it in quotes and got the same results. Would switch possibly work better? -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
Hi Thorpe, Yes, I did read it but forgot to answer it, I'm trying to echo the "Saturday" as text it's not a string. I just want it to say Saturday instead of Y. I agree, being new at this I have an easier time figuring out hand code than I do with Dreamweaver but I just don't have the knowledge to completely hand code a site yet. Should I move this thread then? -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
Thanks, OK here's all of it. <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rs_track_details = "-1"; if (isset($_GET['trkname'])) { $colname_rs_track_details = (get_magic_quotes_gpc()) ? $_GET['trkname'] : addslashes($_GET['trkname']); } mysql_select_db($database_conn_tracks, $conn_tracks); $query_rs_track_details = sprintf("SELECT * FROM tracklist WHERE trkname = %s", GetSQLValueString($colname_rs_track_details, "text")); $rs_track_details = mysql_query($query_rs_track_details, $conn_tracks) or die(mysql_error()); $row_rs_track_details = mysql_fetch_assoc($rs_track_details); $totalRows_rs_track_details = mysql_num_rows($rs_track_details); ?><!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> <title>Race Track Directory</title><meta name="description" content="Race track directory for asphalt and dirt short tracks in the U.S. All divisions including late models, sprints, modifieds, street stocks, mini stocks, pure stocks, scale cars like Legends and Baby Grands plus karts and more." /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="keywords" content="dirt track, asphalt track, short track, oval track, track, racetrack, race track, dirt, asphalt, late model, sprint, modified, street stock, mini stock, kart, sportsman" /> <link rel="stylesheet" type="text/css" href="track_details.css" /> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); } </script> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> <style type="text/css"> <!-- #under_construction { font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; float: left; width: 835px; margin-right: auto; margin-left: auto; position: relative; left: 50px; right: 0px; text-align: center; } a:visited { color: #000000; } #divisions_wrapper { float: left; height: 100%; width: 835px; margin-top: 10px; margin-bottom: 10px; position: relative; } --> </style> </head> <body onload="MM_preloadImages('images/btn_forum_on.gif','images/btn_tech_on.gif','images/btn_home_on.gif','images/btn_catalogs_on.gif','images/btn_sweeps_on.gif','images/btn_schedules_on.gif','images/btn_classified_on.gif','images/btn_magazine_on.gif','images/btn_tracks_on.gif')"> <div id="login_bar"></div> <!-- TemplateBeginEditable name="main_edit_region" --> <div id="main_body_div_wrapper"> <div id="grey_above_logo"></div> <div id="logo"></div> <div id="giving_back_text"></div> <div id="btn_home"><img src="images/btn_home_off.gif" alt="Home" name="btn_home" width="158" height="54" id="btn_home2" style="background-color: #000000" onclick="MM_goToURL('parent','index.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_home','','images/btn_home_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="btn_schedules"><img src="images/btn_schedules_off.gif" alt="Race Schedules" name="btn_schedules" width="156" height="54" id="btn_schedules2" style="background-color: #000000" onclick="MM_goToURL('parent','race_schedules.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_schedules','','images/btn_schedules_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="btn_tech_info"><img src="images/btn_tech_off.gif" alt="Racing Tech Info" name="btn_tech_info" width="155" height="54" id="btn_tech_info2" style="background-color: #000000" onclick="MM_goToURL('parent','racing_tech_info.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_tech_info','','images/btn_tech_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="btn_cassifieds"><img src="images/btn_classified_off.gif" alt="Classifieds" name="btn_classifieds" width="155" height="54" id="btn_classifieds" style="background-color: #000000" onclick="MM_goToURL('parent','race_cars_parts_classifieds.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_classifieds','','images/btn_classified_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="btn_tracks"><img src="images/btn_tracks_off.gif" alt="" name="btn_tracks" width="156" height="54" id="btn_tracks2" style="background-color: #000000" onclick="MM_goToURL('parent','race_track_directory.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_tracks','','images/btn_tracks_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="btn_forum"><img src="images/btn_forum_off.gif" alt="Forum Button" name="btn_forum" width="155" height="54" id="btn_forum" style="background-color: #000000" onclick="MM_goToURL('parent','community/index.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_forum','','images/btn_forum_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="spacer_below_top_menu"></div> <div id="btn_magazine"><img src="images/btn_magazine_off.gif" alt="Short Track USA Magazine" name="btn_magazine" width="470" height="73" id="btn_magazine" onclick="MM_goToURL('parent','short_track_usa.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_magazine','','images/btn_magazine_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="btn_catalogs"><img src="images/btn_catalogs_off.gif" alt="Racing Parts Catalogs" name="btn_catalogs" width="465" height="73" id="btn_catalogs2" style="background-color: #000000" onclick="MM_goToURL('parent','racing_parts_catalogs.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_catalogs','','images/btn_catalogs_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="spacer_above_sweeps"></div> <div id="btn_sweeps"><img src="images/btn_sweeps_off.gif" alt="Racing Sweepstakes" name="btn_racing_sweeps" width="935" height="81" id="btn_racing_sweeps" onclick="MM_goToURL('parent','racing_sweeps_entry.php');return document.MM_returnValue" onmouseover="MM_swapImage('btn_racing_sweeps','','images/btn_sweeps_on.gif',1)" onmouseout="MM_swapImgRestore()" /></div> <div id="lft_barcurve"></div> <div id="top_bar_content_area"></div> <div id="right_barcurve"></div> <div id="content_area_rounded_top"> </div> <div id="content_straight_grey_repeating"> <div id="under_construction"> <div id="address_bkground"> <div id="rounded_top_address"></div> <div id="address_white_stretch"> <div class="trk_name" id="trk_name"><?php echo $row_rs_track_details['trkname']; ?></div> <div id="trk_size"><?php echo $row_rs_track_details['trksize']; ?> Mile</div> <div id="trk_surface">Surface - <?php if ($row_rs_track_details['trksurfacedirt']=="Y") { echo Dirt ; } if ($row_rs_track_details['trksurfaceasphalt']=="Y") { echo Asphalt ; } if ($row_rs_track_details['track_type_both']=="Y") { echo Both; } ?> </div> <div id="trk_phone">Track Phone - <?php echo $row_rs_track_details['trkphone']; ?></div> <div id="web_address">Track website: <?php echo $row_rs_track_details['trkwebsite']; ?></div> <div id="directions">Directions: <?php echo $row_rs_track_details['location']; ?><pre> <?php print_r($row_rs_track_details); ?> </pre></div> </div> <div id="address_bottom_round"></div> <div id="divisions_wrapper"> <div id="divisions_top_round"></div> <div id="divisions_straight_white"> <div id="regular_night">Regular Race Night: <?php if ($row_rs_track_details['fri']=="Y") { echo Friday; } if ($row_rs_track_details['sat']=="Y") { echo Saturday; } if ($row_rs_track_details['sun']=="Y") { echo Sunday; } if ($row_rs_track_details['mon']=="Y") { echo Monday; } if ($row_rs_track_details['tues']=="Y") { echo Tuesday; } if ($row_rs_track_details['wed']=="Y") { echo Wednesday; } if ($row_rs_track_details['thur']=="Y") { echo Thursday; } ?> </div> -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
Well it's not displaying on the "details" page. As mentioned it's really weird because some of the days do display and some don't. As you can see by that output the "Y" is definitely there but it doesn't display "Saturday". The only days that will display are Friday, Sunday and Monday. I wondered if it might just be a display problem and not a data problem but I widened the div where it displays and that wasn't the problem. I just can't figure out why some of the days won't display, especially now that it looks like the code is working. It's not a case where it's a font color blending in to the background either because each of the days are displaying in the same div on the respective "details" pages. -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
That worked. The data does show up. [fri] => N [sat] => Y [sun] => N [mon] => N [tues] => N [wed] => N [thur] => N -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
Sorry, I'm reading my info from a search to try to figure out how to do it but I can't see yet what I should be echoing. Very new at this and to this point I haven't had any problems where I had to learn how to echo the data. Can you tell by the query what I should echo? -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
This is what I used: <?php echo $row_rs_track_details; ?></div> I guess this might help too, here's my query: $colname_rs_track_details = "-1"; if (isset($_GET['trkname'])) { $colname_rs_track_details = (get_magic_quotes_gpc()) ? $_GET['trkname'] : addslashes($_GET['trkname']); } mysql_select_db($database_conn_tracks, $conn_tracks); $query_rs_track_details = sprintf("SELECT * FROM tracklist WHERE trkname = %s", GetSQLValueString($colname_rs_track_details, "text")); $rs_track_details = mysql_query($query_rs_track_details, $conn_tracks) or die(mysql_error()); $row_rs_track_details = mysql_fetch_assoc($rs_track_details); $totalRows_rs_track_details = mysql_num_rows($rs_track_details); ?> -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
I took that line out and now it displays "ARRAY" but no data after it. I placed the echo in a div that will stretch so that should work shouldn't it? -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
I tried this code but I'm not getting any output. The rest of the data for this row is still displaying correctly but I'm not seeing any output from the string. <?php $row_rs_track_details = mysql_fetch_assoc($rs_track_details); echo $row_rs_track_details; ?></div> -
If clause code returning unexpected results
SaturdayNightSpecial replied to SaturdayNightSpecial's topic in PHP Coding Help
I haven't echoed them yet as I don't know how to do that but I was heading to Google to find out when your reply popped up. I'm new at PHP but I think the answer is that they are defined constants. The columns are checkboxes on a form with Y or N values. -
I'm getting some weird results with this code and need some help to see if anyone can see what's going wrong. I've got an "if" clause for each day of the week that is being displayed on a detail page. Friday, Sunday and Monday are displaying fine but Tues, Sat, Wed and Thurs are not displaying. There's a separate column for each day of the week and I've scoured over the column settings and all of them are the same. I've also confirmed the spelling on the column names in the code numerous times and all are correct. I also tried "else if" but it was the same result. Here's the code: <?php if ($row_rs_track_details['fri']=="Y") { echo Friday; } if ($row_rs_track_details['sat']=="Y") { echo Saturday; } if ($row_rs_track_details['sun']=="Y") { echo Sunday; } if ($row_rs_track_details['mon']=="Y") { echo Monday; } if ($row_rs_track_details['tues']=="Y") { echo Tuesday; } if ($row_rs_track_details['wed']=="Y") { echo Wednesday; } if ($row_rs_track_details['thur']=="Y") { echo Thursday; } ?></div> I'm using this same type of code in another place on the page with three columns and it seems to be working fine. Thanks,