Jump to content

Call-911

Members
  • Posts

    51
  • Joined

  • Last visited

    Never

Everything posted by Call-911

  1. That's exactly what I want to do, but to do it with Checkboxes. I know how to do that with dropdown menus or radio boxes, but how can I make a check box so they can go through and say "ID 5" has "Basketball", "Baseball", and "Chess Team" and to have it turn out: StudentID | Activities 5 | Basketball 5 | Baseball 5 | Chess Team
  2. Hey All, I tried seraching, but I'm not sure what exactly to search for. Here's what I need to do, and any push in the right direction would be great: I have a PHP form, with the Following: Text Box: Student ID Checkboxes for Activities What I need to do is somehow loop through and make a new row for each activity. Example, if I entered Student ID 105 and Activities are Basketball, Baseball, and Chess Team, I need three different rows in the database each listing the individual activity and the student ID. Any suggestions? I know how to do this if it was one entry (radio buttons) but want to be able to enter multiple rows at a time. Thanks!
  3. Hey All, I need to count and display the number of rows I have. <?php //declare the SQL statement that will query the database $query = " SELECT COUNT(id) FROM connectvisits WHERE staffid = '$staffid' "; //execute the SQL query and return records $result = mssql_query($query); $thismonth = mssql_num_rows($result); echo "Total Meetings This Month: "; echo $thismonth; echo "<br />"; ?> For some reason I keep getting a result of 1. Everything else I try gives me a "Resource ID" number. Any help would be apprecaited. Maybe I have the completely wrong code. Thanks!
  4. Hello All, I need to count the number of SQL date entries we have per year. I can coun this by: SELECT COUNT(*) FROM news WHERE show='true' AND date >= '2011-07-01' But how can I make it change years automatically. Our fiscal year starts July 1, and I'd like it to restart the count automatically every year. Does that make sense?
  5. Hello All, I have the following code: echo "<table width='615px' cellpadding='3' cellspacing='4' align='center'>"; echo "<tr>"; echo "<td align='left' width='150px'>"; echo substr($row['date'],0,11); echo "</td>"; echo "<td align='left' width='465px'>"; echo $row["food"] ; echo "</td>"; echo "</tr>"; echo "</table>"; And this outputs: Apr 4 2011 Chicken Ceasar Salad, Garlic Toast, Cloddhoppers, Applesauce, & Milk (etc.) How can I add "Mon" in front of "Apr 4 2011"? thanks!
  6. Hello All, I have the following Database Columns: Name, Phone, Email, Keyword What I want to do is store all values in the database based off of the "keyword", so if Row 1 is "John Doe, 123-456-7890, johndoe@yahoo.com, President", then I want to store the following variables: $Presidentname = John Doe $Presidentphone = 123-456-7890 $Presidentemail = johndoe@yahoo.com It seems like it should be easy enough to query a database and assign these variables easily, but I am somehow missing it.... Thanks!
  7. But then how would I only choose one value on a page and not all. Say I want to have a marketing director's bio page. I only want to select his row from the database and stored as a value, not all 2000 staff. I want to use one database for everything, but then pull out people as needed. The only way I can figure out how to do that is to do a "SELECT * FROM table WHERE keyword = 'marketingdirectory'" But I don't want to do for every single person I need to show.
  8. Hello All, I have a contact directory database. It has all the employees of my company (name, phone, email, department, building, etc). Say on one page I have the Marketing Department, and I want to say: "The Marketing Department Director is ________" How would I assign that value from the database? Do I want to put in a unique "keyword" field in the database, but then how would I store all the values automatically on the page? I see pages where I would want to list the Marketing Director, and his secretary, then another page with the Sales Director, and his secretary, etc.... all with being able to change the values in the database, and it changing across all the pages instantly. Do I need to say on every page "select * from database where keyword = marketingdirector" and then store that result as a variable? It seems unpractical to repeat that a few times for each different person I want to list. Is there a better way to do this then I'm thinking? Thanks all!
  9. Ah! That helped!! utf8_encode that was the magic I was missing. Thanks!
  10. Hey all, I can not get utf-8 working properly. I'm having issues with special characters, such as bullets, e with an accent over it, etc. The data is being stored in my mssql database properly, and I can see everything there fine. It's when I grab it from the database and display it on my php page. The page it set up to utf-8, if I go to Tools>Page Info, it says encoding is utf-8. I have it in my headers, I just can not figure out why it will not display on the page. Any thoughts?
  11. I think that's exactly it!! How would I do that?? And I am useing a plaintext form I built in HTML, but my client is copy/pasting from MS Word. It needs to be idiot-proof, because the client isn't computer savy.
  12. That's not working. Any other guesses? It only happens in my text areas stored in my MSSQL databases. It's mostly happening to apostrophes, but bullets do it too.
  13. Hello all, I'm having a problem with people uploading News Articles into my news database. Right now, some of them must be using a weird font to type up their stories, because when they copy/paste their story from Word to the PHP form, it makes the ' turn into the little empty boxes. Also, the same thing is happening to bullets. Any idea how to make ther ' show up correctly, and the bullets to either show, or to convert their bullets to dashes. thanks.
  14. Hello All, I have a datetime column. I'm making an archive, and I need to query the database to get all results from a specific month and year. I can get all results from a year by doing: SELECT * FROM news WHERE show = 'true' AND date LIKE '%2011%' ORDER BY date desc, id2 desc But if I try to add in the month SELECT * FROM news WHERE show = 'true' AND date LIKE '%2011-01%' ORDER BY date desc, id2 desc it doesn't work. Any thoughts, or any idea how to get results from the datetime using just the month and date?
  15. zenlord, I can do that manually and manually link up the months to something like stories.php?month=january But how can I have PHP automatically create a new month every month. ie, right now it would say 2011 February Janaury 2010 December November etc. etc. But then on March 1 this year automatically add in march so it goes to 2011 March February January etc...
  16. Hello All, I have a News database in which articles are entered in. Right now all the stories are being display in one big page with every story on it. What I would like to do is to create an "archive" in which it automatically organizes the stories by their date. For example. 2011 February January 2010 December November October September etc... etc... I have a datetime field for the database, and I know how to do this all manually, but I can't figure out how to make it automatically add a month each month. It would be too much maintanence to have to update this every month. I also don't know what this would be called, so I don't even know what to search for. I've tried blog and news, but doesn't seem to be what I want. Any help would be appreciated!
  17. Hello All, I have read through this script a million times, and I can not for the life of me figure out how the script decides which day of the week to start on. Right now the week starts on Monday (which goes against every other calendar we use). I need to figure out how to make the week start on Sunday. Here's the script: <style type='text/css'> .outofrange { background-color: #d9cdb3; } .currentday { background-color: #ccc; } </style> <?PHP $Year = preg_replace("/[^0-9]/","",$_GET['year']); $Month = preg_replace("/[^0-9]/","",$_GET['month']); if ($Month == "") { $Month = date("n"); } if ($Year == "") { $Year = date("Y"); } if ($Month==0) { $Month=12; $Year--; } if ($Month==13) { $Month=1; $Year++; } $myServer = "xxxxxx"; $myUser = "xxxxxx"; $myPass = "xxxxxx"; $myDB = "Calendar"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); //declare the SQL statement that will query the database $query = " SELECT * FROM calendar WHERE school = '00' "; //execute the SQL query and return records $result = mssql_query($query); //display the results while($row = mssql_fetch_array($result)) { if (date("Y",strtotime($row['date']))==$Year) { $Event[date("z",strtotime($row['date'])+1)+1] .= $row['event'] . "<br />" . "<font color='#" . $row['colors'] . "'>" . $row['location'] . "</font>" . "<p>"; } } $Timestamp = strtotime("$Year-$Month-01"); for ($Day=1;$Day<=32;$Day++) { if (checkdate($Month,$Day,$Year)) { $LastDayInMonth = $Day; } } $FirstDayInMonth = date("N",$Timestamp); for ($MakeCal=$FirstDayInMonth;$MakeCal<=$FirstDayInMonth+$LastDayInMonth;$MakeCal++) { //echo "$MakeCal<br />"; } $WeeksNeeded = ceil(($FirstDayInMonth+$LastDayInMonth)/7); echo "<div align='center'><span class='bodyb'>" . date("F Y",$Timestamp) . "</span></div><p>"; echo "<table width='100%' border='0'> <tr> <td align='left' valign='top'><a href='index.php?month=" . (($Month)-1) . "&year=$Year' class='monthview'>Previous Month</a></td> <td align='right' valign='top'><a href='index.php?month=" . (($Month)+1) . "&year=$Year' class='monthview'>Next Month</a></span></td> </tr> </table>"; echo "<p>"; //Main Table starting with days of week through the month views// echo "<table width='615px' cellspacing='0' cellpadding='2' border='1' bordercolor='#666666'> <tr> <th>Monday</th> <th>Tuesday</th> <th>Wednesday</th> <th>Thursday</th> <th>Friday</th> <th>Saturday</th> <th>Sunday</th> </tr> "; for ($DoWeeks=1;$DoWeeks<=$WeeksNeeded;$DoWeeks++) { for ($DoDays=1;$DoDays<=7;$DoDays++) { $CurrentDay++; if ($CurrentDay < $FirstDayInMonth) { echo "<td width='10%' class='outofrange'> </td>"; } else { if (($CurrentDay-$FirstDayInMonth)+1>$LastDayInMonth) { echo "<td width='10%' class='outofrange'> </td>"; } else { $DayOfYear = date("z",strtotime("$Year-$Month-" . (($CurrentDay-$FirstDayInMonth)+1))) + 1; if ($DayOfYear==date("z")+1 && date("Y")==$Year) { echo "<td width='10%' height='100' valign='top' class='currentday'><strong>" . (($CurrentDay-$FirstDayInMonth)+1) . "</strong><br />"; } else { echo "<td width='10%' height='100' valign='top'><strong>" . (($CurrentDay-$FirstDayInMonth)+1) . "</strong><br />"; } if ($Event[$DayOfYear]!="") { echo $Event[$DayOfYear] . $Location[$DayOfYear] . "<p /></font>"; } echo "</td>"; } } } echo "</tr><tr>"; } echo "</table><p>";
  18. Hello all. I have a textarea on a form that users are posting new's stories into. Most are just copy/pasteing from Word, and they need to be able to include single quotes. (ie: John's favorite store is Micky's) I can't figure out how to make the single quotes (') into double quotes ('') so MSSQL will insert them in. Any help? Here's my process code: <?php $title = $_POST['title']; $district = $_POST['district']; $central = $_POST['central']; $east = $_POST['east']; $north = $_POST['north']; $west = $_POST['west']; $story = $_POST['story']; $date = date("l, M j, Y"); $sqlpicturename = "$picturename.jpg"; $showpicture = $_POST['showpicture']; //declare the SQL statement that will query the database $query = " INSERT INTO News (district, central, east, north, west, date, title, story, picture, showpicture, show) Values ('$district' , '$central', '$east' , '$north', '$west' , '$date', '$title' , '$story', '$sqlpicturename' , '$showpicture' , 'true') "; //execute the SQL query and return records $result = mssql_query($query); //display the results echo "Thank You For Posting Your Story:<b> $title </b><br /><br /><a href='addstory.php'>Click Here To Add Another Story</a><br /><br /><a href='index.php'>Click Here To Go Back To The WebEdit Menu</a>"; echo "<br /><br />"; mssql_close(); ?>
  19. I could of sworn I did exactly that, but what you did worked. I must of messed up a character somewhere. Thank you!
  20. My functions.php file that I include. <?php function fixQuotes($filterString) { RETURN str_replace(chr(133),"...", str_replace(chr(241),"&#241;", str_replace(chr(150),"-", str_replace(chr(145),"'", str_replace(chr(146),"'", str_replace(chr(146),"'", str_replace(chr(147),"\"", str_replace(chr(148),"\"", str_replace(chr(133),"&#169;", str_replace(chr(198),"'", str_replace(chr(246),"", str_replace(chr(244),"", $filterString)))))))))))); } function shortVersion($condense) { RETURN substr($condense,0,stripos($condense,"<br")); } function shortVersion2($condense2) { RETURN substr($condense2,0,stripos($condense2,"\r\n")); } function nodoublespace($removespace) { RETURN str_replace(" ","",$removespace); } function single_quote($replacequote) { RETURN str_replace("'","'",$replacequote); }
  21. Yes, the above is being echo'd by php. The script works fine, but I need to add nl2br because it's not showing line breaks. ie, if it's stored in the database as: testing sentence one. testing sentence two. It's displayed as: testing sentence one.testing sentence two. coupe-r's solution didn't work. Not sure why not... in theory it looks like it would work, but the row "overview" wouldn't display when I tried that.
×
×
  • 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.