Jump to content

mtoynbee

Members
  • Posts

    111
  • Joined

  • Last visited

    Never

Everything posted by mtoynbee

  1. I have a delete trigger but I want to email me the username field value that has been deleted. Is this possible - if so how? Sample code: CREATE TRIGGER delUsers ON db_users AFTER DELETE AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; EXECUTE MSDB.dbo.sp_send_dbmail @profile_name = 'Mail Profile 1' , @recipients = 'me@email.co.uk' , @copy_recipients = '' , @blind_copy_recipients = '' , @SUBJECT = 'User Deleted' , @body = 'User Deleted' , @body_format = 'HTML' , @importance = 'Normal' , @sensitivity = 'Normal' END GO
  2. http://www.html-faq.com/htmlframes/?framesareevil
  3. Was trying to keep it as close to the original script as possible. However I would actually use my selectbox function... if (!function_exists('SelectBox')) { function SelectBox($name,$class,$vars,$labels,$js=false,$alphabetise=false,$status=false,$selected_value=false,$dont_title_case=false,$return_as_variable=false) { if ($selected_value) { $selected_value = ereg_replace("\(","\\(",$selected_value); $selected_value = ereg_replace("\)","\\)",$selected_value); $selected_value = ereg_replace("\?","\\?",$selected_value); if (!eregi("\^|",$vars)) { $remove_bars = true; } $vars = "|".$vars."|"; $vars = ereg_replace("\|".$selected_value."\|", "\|".$selected_value."*\|", $vars); if (substr($vars, -1) == "|" && !$remove_bars) { $vars = substr($vars,1,-1); } if (substr($vars, -1) == "|" && $remove_bars) { $vars = substr($vars,0,-1); } $vars = stripslashes($vars); unset($selected_value); if ($remove_bars) { $vars = substr ($vars,1); } } if (eregi("\(Blanks\)",$labels)) { $rearrange_array = true; } $class = explode ("|",$class); $vars = explode ("|",$vars); $labels = explode ("|",$labels); if ($alphabetise) { if ($rearrange_array) { $labels = array_slice($labels, 0, count($labels) - 2); $vars = array_slice($vars, 0, count($vars) - 2); array_multisort($labels, SORT_ASC, SORT_STRING, $vars, SORT_NUMERIC, SORT_DESC); array_push($labels, "(Blanks)", "(NonBlanks)"); array_push($vars, "(Blanks)", "(NonBlanks)"); } else { array_multisort($labels, SORT_ASC, SORT_STRING, $vars, SORT_NUMERIC, SORT_DESC); } } if ($js == "redirect_blank") { $js = "window.open(this.form.$name.options[this.form.$name.selectedIndex].value);"; } if ($js == "redirect") { $js = "location=this.form.$name.options[this.form.$name.selectedIndex].value;"; } if ($js) { if (!eregi("^onfocus",$js) && !eregi("^onblur",$js) && !eregi("^onclick",$js) && !eregi("^onmouseover",$js)) { $js = " onchange=\"$js\""; } } $returned_sb = "<select name=\"$name\" id=\"$name\" class=\"$class[0]\"$js $status>"; for ($i=0;$i<count($labels);$i++) { if ($class[1] && $i > 0) { $class[0] = $class[1]; } if (eregi("\*",$vars[$i])) { $vars[$i] = ereg_replace ("\*", "", $vars[$i]); $labels[$i] = ereg_replace ("\*", "", $labels[$i]); $returned_sb.= "<option class=\"$class[0]\" value=\"".trim($vars[$i])."\" selected=\"selected\">".strtotitle(trim($labels[$i]),$dont_title_case)."</option>"; } else { $returned_sb.= "<option class=\"$class[0]\" value=\"".trim($vars[$i])."\">".strtotitle(trim($labels[$i]),$dont_title_case)."</option>"; } } $returned_sb.= "</select>"; if ($return_as_variable == true) { return $returned_sb; } else { echo $returned_sb; } } }
  4. This is a good solution for what you are doing: <?php echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">"; echo "Month: <select name=\"month\" id=\"month\">"; $topValue = isset($_POST['month'])?intval($_POST['month']):"Select"; echo "<option value=\"please pick\" >".$topValue."</option>"; echo "<option value=\"1\">1</option>"; echo "<option value=\"2\">2</option>"; echo "<option value=\"3\">3</option>"; echo "<option value=\"4\">4</option>"; echo "<option value=\"5\">5</option>"; echo "<option value=\"6\">6</option>"; echo "<option value=\"7\">7</option>"; echo "<option value=\"8\">8</option>"; echo "<option value=\"9\">9</option>"; echo "<option value=\"10\">10</option>"; echo "<option value=\"11\">11</option>"; echo "<option value=\"12\">12</option>"; echo "</select>";
  5. Need single quotes around date in sql query $query = mysql_query("SELECT * FROM `mp3links` WHERE `foundtime` < '".$day_old."' AND `scraped` != '0' ORDER BY `foundtime` DESC") or die(mysql_error());
  6. You need to add: error_reporting(E_ALL); So you can determine the error and which line. However I think it is the syntax: print"<b>Last name:</b>{$_POST['lname']} <br>"; Should be: print"<b>Last name:</b>".$_POST['lname']."<br>"; And the same for fname...
  7. It could be dodgy - I have seem some encrypted JS which can run nasty ActiveX programmes on your PC. It looks a lot like this code.
  8. echo $query = "insert into $table (event_name, venue_name, streetaddress1, streetaddress2, town, event_description, event_date, event_time) values ('" .$_SESSION['evname']. "', '".$_SESSION['venuename']."', '".$_SESSION['addr1']."', '".$_SESSION['addr2']."', '".$_SESSION['town']."', '".$_SESSION['content']."', '".$_SESSION['fulldate']."', '".$_SESSION['time']."',)"; $insert = mysql_query($query) or die("Could not insert data because ".mysql_error());
  9. The loop should start with 1 - sorry see code below - have tested and works <script> function countTotal() // Note no variables { var total = 0; var fieldName; for(i=1;i<19;i++) { fieldName = 'total_shot_'+i; if (!isNaN(Number(document.getElementById(fieldName).value))) { total=total+Number(document.getElementById(fieldName).value); } } document.getElementById("total").value = total; } </script> <input class="gameData" name="total_shot_1" type="text" id="total_shot_1" size="2" maxlength="2" onChange="javascript:countTotal();"> <input class="gameData" name="total_shot_2" type="text" id="total_shot_2" size="2" maxlength="2" onChange="javascript:countTotal();"> <input class="gameData" name="total_shot_3" type="text" id="total_shot_3" size="2" maxlength="2" onChange="javascript:countTotal();"> <input class="gameData" name="total_shot_4" type="text" id="total_shot_4" size="2" maxlength="2" onChange="javascript:countTotal();"> etc up to 18 <input class="gameData" name="total" type="text" id="total" size="2" maxlength="2" value="0">
  10. function countTotal() // Note no variables { var total = 0; var fieldName; for(i=0;i<19;i++) { fieldName = 'total_shot_'+i; if (!isNaN(Number(document.getElementById(fieldName).value))) { total=total+Number(document.getElementById(fieldName).value); } } document.getElementById("total").value = total; }
  11. SELECT COUNT(*) AS player_count FROM players WHERE prison >= 1
  12. echo "<td><div align='center'><a href=\"mailto:" . $row['email'] . "\">" . $row['email'] . "</a></td>";
  13. There is a much simpler way of doing it than that - but is easier to explain when I can refer to parts of the original code - please post it.
  14. As with previous example you need to output the fields in the same format hence you cannot output 'Nothing' (varchar value) for an integer without CAST(ing) the integer. This is the same for the datetime field as 0 is not a valid datetime value. Your best bet for this is just to output as NULL.
  15. These are the available date formats in MSSQL - not sure it supports the "th" or "st" or "rd" or "nd" suffixes... PRINT '1) HERE IS MON DD YYYY HH:MIAM (OR PM) FORMAT ==>' + CONVERT(CHAR(19),GETDATE()) PRINT '2) HERE IS MM-DD-YY FORMAT ==>' + CONVERT(CHAR(,GETDATE(),10) PRINT '3) HERE IS MM-DD-YYYY FORMAT ==>' + CONVERT(CHAR(10),GETDATE(),110) PRINT '4) HERE IS DD MON YYYY FORMAT ==>' + CONVERT(CHAR(11),GETDATE(),106) PRINT '5) HERE IS DD MON YY FORMAT ==>' + CONVERT(CHAR(9),GETDATE(),6) PRINT '6) HERE IS DD MON YYYY HH:MM:SS:MMM(24H) FORMAT ==>' + CONVERT(CHAR(24),GETDATE(),113) Here is the output from the above script: 1) HERE IS MON DD YYYY HH:MIAM (OR PM) FORMAT ==>Feb 5 2003 5:54AM 2) HERE IS MM-DD-YY FORMAT ==>02-05-03 3) HERE IS MM-DD-YYYY FORMAT ==>02-05-2003 4) HERE IS DD MON YYYY FORMAT ==>05 Feb 2003 5) HERE IS DD MON YY FORMAT ==>05 Feb 03 6) HERE IS DD MON YYYY HH:MM:SS:MMM(24H) FORMAT ==>05 Feb 2003 05:54:39:567
  16. As far as I know you cannot store arrays in a session. Therefore the stored values of 'files' will be just the word Array. You should be able to get around this by serializing the array first. See PHP Manual serialize() function for more information: http://uk.php.net/serialize
  17. Something like this? SELECT a.*,b.*,c.*,d.*,e.* FROM Person_tbl AS a LEFT OUTER JOIN Person_Learning AS b ON a.Person_ID = b.ID LEFT OUTER JOIN Learnin_style AS c ON b.Learning_ID = c.Learning_ID LEFT OUTER JOIN Skill_Learning AS d ON d.Learning_ID = b.Learning_ID LEFT OUTER JOIN Skill_Tbl AS e ON e.Skill_ID = d.Skill_ID You can use INNER JOIN if you know there will definitely a matching ID in every table and no NULLs
  18. Can we just be realistic here?! The idea of saving comma separated values in a fields and then calling it an "array" and then trying to query it is ridiculous. Get real - learn how normalisation works and learn what is involved in logical database design.
  19. <input type="text" onfocus="this.type='password'; this.value='';" name="fpassword" value="Password" size="15" maxlength="15">
×
×
  • 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.