-
Posts
623 -
Joined
-
Last visited
Everything posted by TOA
-
Are you using get or post? *EDIT* (Thought: "get" most likely if your passing a variable in the url. Duh DA)
-
Retrieving event from data base and displaying on calendar
TOA replied to bobby317's topic in PHP Coding Help
Ok, first of all...NEVER put your database info up on a forum...BAD, BAD, BAD I'm done *tisking* now I played with your original code and what I posted and got everything to work beautifully. In the query, I doubt your field name is "Field" so one issue might be that it needs to be the actual field your trying to select. And make sure the field name you're using in your WHERE is actually date (those were all just generic names to use in the example) Another thing I noticed are in these lines: You have event and events And if those don't work, try combining $year$Month$day_num into its own variable, maybe your php doesn't like the way I used those variables there. Try those and let me know what happens. -
I've done it like this in the past, using sessions, but there are alot of different ways. // In this case, $count is a remaining number out of a total number ex. 3 out of 10 so count would be 7 and Next button would be displayed if ($count > 0) { // then set a session var to match $_SESSION['submit'] = "next"; echo '<div><button type="submit" name="next">Next</button>'; } else { $_SESSION['submit'] = "done"; echo '<div><button type="submit" name="done">Done</button>'; echo "Thank you for completing survey!<br />Hit <i>Done</i> when finished!"; } // Then you can check if ($_SESSION[submit] == "next") { do something } else { do something else } Not exact, and not tested, but should get you going in the right direction. Hope that helps
-
Retrieving event from data base and displaying on calendar
TOA replied to bobby317's topic in PHP Coding Help
Ok, played around with your code for a while, and here's what I came up with. You'll need to tweak it a little, but this should get you going in the right direction while( $day_num <= $days_in_month ){ if(date('d') !=$day_num) { echo '<td class="everyday"><b>'.$day_num.'</b>'; $everyday_res = mysql_query("SELECT Field FROM Table WHERE Date_Avail='$year$month$day_num'", $con); while ($row_d = mysql_fetch_assoc($everyday_res)) { echo $row_d['Field']; } echo "</td>\r\n"; $day_num++; $day_count++; } else { echo '<td class="today"><b><i>'.$day_num.'</i></b>'; $today_res = mysql_query("SELECT Field FROM Table WHERE Date_Avail='$todays_date'", $con); while ($row_t = mysql_fetch_assoc($today_res)) { echo $row_t['Field']; } echo "</td>\r\n"; $day_num++; $day_count++; } //create a new row if ($day_count > 7){ echo "</tr><tr>\r\n"; $day_count = 1; } } -
Yeah, I was wondering what those "\"'s were doing in there, but you had them in there so I left them. Glad you got it working
-
Retrieving event from data base and displaying on calendar
TOA replied to bobby317's topic in PHP Coding Help
Your code looks pretty good. If you say it works I'll take your word for it. One thing I would say though, is that you need to read up on concatenation. What you need to do now is write a query that gets the event based on the day (so figure out how to do WHERE Date=$day_of_month or whatever variable it needs to be from your code) Then throw it into your echo. You know your code better than I do, what variable do you think you would use to determine what event to get? -
Retrieving event from data base and displaying on calendar
TOA replied to bobby317's topic in PHP Coding Help
That's alot of code. :-\ What is it that you're trying to do? What works and what doesn't? What have you tried so far? -
Looks like you're having issues with concatenation. You can't use a " inside a "" without escaping it first. I would rewrite it to look like this: <?php echo '<a href="'. $_SESSION['SESS_LAST_NAME'].'\vault\\'.$_SESSION['SESS_FIRST_NAME'].'.php\">Access files</a>';
-
Thanks in advance Try taking out the escapes and see what that does
-
Is there a way to redirect bad requests to a 404 page?
TOA replied to healthbasics's topic in PHP Coding Help
Well, the header is the way to go. How you decide to test the condition I'm not sure. For ex. if (condition == failure) { header(); } else { display } Hope that helps -
Is there a way to redirect bad requests to a 404 page?
TOA replied to healthbasics's topic in PHP Coding Help
I don't have my sql and there is no implementation for checking or anything in place. That's what I'm trying to do now. I was trying to prevent people that send a bad request (for example if the site changes and there are latent search engine links) from simply getting a completely blank white page. Is there an easy way to do this? @DevilsAdvocate - I read that but it doesn't really make clear to me what I have to put where to accomplish what I'm trying to do. Replace where it says "// redirect to 404" in the code Mchl posted with the header call -
Is there a way to redirect bad requests to a 404 page?
TOA replied to healthbasics's topic in PHP Coding Help
php.net/manual/en/function.header.php So it would be header("location: .\php\not_found.php"); You can also do a timed redirect like this header("refresh:5; url='.\php\not_found.php'"); -
Those conditions are actually in the code. I have posted what they where, but, for the sake of consitency, I will post them once more. In index.php he has these lines of code: include "menu.inc.php"; function menu($_menu){ $str = ''; foreach($_menu as $url => $name){ $sel = ($_GET['page'] == $url ) ? ' id="selected" ' : ''; $str .= "<li ". $sel ."><a href=" . $url . " >" . $name . "</a>\n"; } echo $str; } $page = ( isset($_GET['pg']) ? $_GET['pg'] : ((isset($_GET['page']))? $_GET['page']:'home')); $file = basename($page).'.php'; $html_path = "php/"; and <?php if (file_exists($html_path.$file)) include $html_path.$file; ?> These lines are what is causing the double posting. I just suggested that he return it to the original and we try and help him with another way of getting the dynamic things in there. Using a header and footer file would defeat the purpose of what he already had. Guess I'm seeing it in a different way
-
First try to echo all your $_POST data to make sure it's coming through
-
The correct syntax to delete something in mysql is DROP **EDIT My bad, didn't read what you were trying to do correctly....ignore this post sorry
-
Glad to help
-
Still not sure what index.php is doing. If you want to use it as a placeholder type file, then you need to write in some conditions that say "if this is the case include home.html else include another file". Index should have the structure: (in pseudo) include header decision block to determine what page to show and title to put up include footer Or am I missing your intentions?
-
Did you change the field and table names to match yours? he does that, just change signup_ac.php to your desired redirect location like: header(refresh:5; url='blah.html');
-
Let me see if I get you right...you wrote a script that signs up users and forgot to put in an insert, so the users aren't being registered?
-
if ($val == 'premium' || $val == 'premium2') { do this } else { otherwise do this }