Jump to content

bobby317

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

About bobby317

  • Birthday 03/17/1984

Contact Methods

  • Website URL
    http://www.rwddesign.com

Profile Information

  • Gender
    Male

bobby317's Achievements

Member

Member (2/5)

0

Reputation

  1. Lets see your CSS code. Internet explorer has some issues using table tags and css you can google that and get some good info. But basicly you would have to do something like: body table { height: 300px; } I suspect you are just doing table { height: 300px; } same goes for <tr> you have to do table tr { height: 300px; } If you are having this problem with fire fox make sure you have ; after all css it is picky. let me know if this help and post CSS
  2. bobby317

    HTML5

    There will be than just doctype do some research on it. There are some pretty cool changes comming. Check this site out for starters. http://www.w3schools.com/html5/html5_reference.asp
  3. This helped me maybe it will for you as well: http://www.richardlord.net/blog/dates-in-php-and-mysql
  4. I think you are not checking if the form is submitted: add a hidden field to your form <input type="hidden" name="submit" value="true" /> then see if form has been submitted if it has been do something: <?php if (isset($_POST['submit'])) { //set to variable for easer use $name = "$_POST['name']"; //echo variable echo "$name"; } Hope this helps: http://www.php.net/manual/en/index.php
  5. What is the correct way to store a price in a mysql database. Here is an example: 15.49. Also if you could explain why so I can learn or point me to some resources. THanks.
  6. I was wondering what is the proper way to store prices in a database example 15.98. Also if anyone can recomend any site to read up on this would be great to thanks.
  7. will do and thanks for everything.
  8. Here is the code for my login page: <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Login</title> <link href="eventMain.css" rel="stylesheet" type="text/css" /> </head> <body> <?php //Starts the code when form is submitted: if( !isset($_POST['submit'])){ include_once "loginform.html"; } else { //Flag varable to track sucsess $okey = TRUE; //Check that email is not empty if (empty($_POST['email1'])) { print '<p class="error">Please enter your email address.</p>'; include_once "loginform.html"; $okey = FALSE; //check that email is not empty } elseif (empty($_POST['pass1'])) { print '<p class="error">Please enter your password</p>'; include_once "loginform.html"; $okey = FALSE; //If there were no errors, print a success message: } elseif ($okey == TRUE) { //Trims email and password and sets to a varible: $email = trim($_POST['email1']); $password = trim($_POST['pass1']); //Encript password using email as salt: $password = sha1($email.$password); //Include files for conecting to database: $dbc = mysql_connect('rwddesign.com:3306', 'rwddesi1_bobby31', 'jessica'); mysql_select_db('rwddesi1_test'); //Query for checking database for user name and pass $loginQuery = "SELECT * FROM users WHERE email = '$email' and password = '$password'"; //Gets results from above query $result = mysql_query($loginQuery); //Count number of rows returned from query $count = mysql_num_rows($result); //checks if there is a match if ($count == 1) { //If there is a match include "addevent.php"; //If no Match } else { print '<p class="error">Wrong Username or Password</p>'; include_once "loginform.html"; } } } ?> </body> </html> And here is the page it goes to: <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Add Event</title> </head> <link href="eventMain.css" rel="stylesheet" type="text/css" /> <body> <?php //set addEventForm.html for include to a varibal $form = "addEventForm.html"; $calendar = "1stCalendar.php"; //Start code when form is submited if( !isset($_POST['submit'])) { include_once "$form"; include_once "$calendar"; } else { //Flag varible to track success $okay = TRUE; //Valadate name field if (empty($_POST['eventName'])) { print '<p class="error">Please the event your name.</p>'; $okay = FALSE; include_once "$form"; include_once "$calendar"; //Valadate date //Month } elseif (empty($_POST['month'])) { print '<p class="error">Please enter the month.</p>'; $okay = FALSE; include_once "$form"; include_once "$calendar"; //Day } elseif (empty($_POST['day'])) { print'<p class="eroor">Please enter the day.</p>'; $okay = FALSE; include_once "$form"; include_once "$calendar"; //Year } elseif (empty($_POST['year'])) { print'<p class="error">Please enter the year.</p>'; $okay = FALSE; include_once "$form"; include_once "$calendar"; //Valadate startTime } elseif (empty($_POST['startTime'])) { print'<p class="error">Please enter a start time.</p>'; $okay = FALSE; include_once "$form"; include_once "$calendar"; //Valadate endTime } elseif (empty($_POST['endTime'])) { print'<p class="error">Please enter a end time.</p>'; $okay = FALSE; include_once "$form"; include_once "$calendar"; //Valadate description } elseif (empty($_POST['description'])) { print'<p class="error">Please enter a description.</p>'; $okay = FALSE; include_once "$form"; include_once "$calendar"; //If $okay = TRUE orginize data and input into database } elseif ($okay == TRUE) { //remove white spaces create varables $eventName = trim($_POST['eventName']); $startTime = trim($_POST['startTime']); $timeOfDay1 = $_POST['timeOfDay1']; $endTime = trim($_POST['endTime']); $timeOfDay2 = $_POST['timeOfDay2']; $description = trim($_POST['description']); //Set am or pm for time $fStartTime = "$startTime $timeOfDay1"; $fEndTime = "$endTime $timeOfDay2"; //get date put to varable $date = "{$_POST['day']}-{$_POST['month']}-{$_POST['year']}"; //convert date to timestamp $Tdate = strtotime($date); //Include files for conecting to database: $dbc = mysql_connect('rwddesign.com:3306', 'rwddesi1_bobby31', 'jessica'); mysql_select_db('rwddesi1_test'); //Define the query: $query = "INSERT INTO events (eventID, date, startTime, endTime, eventName, description) VALUES (0, FROM_UNIXTIME($Tdate), '$fStartTime', '$fEndTime', '$eventName', '$description')"; //Exicute query if (@mysql_query($query)) { //Print message if secsessful print '<h1>Your event has been added!</h1>'; include_once "$form"; include_once "$calendar"; } else { //print message for all other errors. print '<h1 class="error">Could not add event because:' . mysql_error() . ' .</h1> <p class="error">The query being run was: ' . $query . '</p>'; include_once "$calendar"; include_once "$form"; } } } ?> </body> </html> Thanks again and please explain anything so I can learn.
  9. Right now I have my login working and goes where I want it to. But say you type in the address of the part the login page takes you to if you login successfully it will bypass the login and show the page without being logged in. So I want to find a fix for this. I think it involves cookies or seasons but I am new to those. Is there anyone who could guide me in the proper way to make this more secure or point me to some online sources? Thanks.
  10. Ok I finally got it. What I did was set the {$row['eventName']} to a variable then called that variable in my echo. I also had to move the part were I echo outside the second where statement and place it out side it and after also had to set the $event_name varable to blank at the end of the where statement. I have got the main functions working now just need to style and add some other featers that I am pritty familure with. Thank you everyone could not have done it with out you. Here is the code that worked: <?php //CSS style print '<link href="eventMain.css" rel="stylesheet" type="text/css" />'; //This gets today's date $date = time (); //This puts the day, month, and year in seperate variables $day = date('d', $date); $month = date('m', $date); $year = date('Y', $date); //Here we generate the first day of the month $first_day = mktime(0,0,0,$month, 1, $year); //This gets us the month name $title = date('F', $first_day); //Here we find out what day of the week the first day of the month falls on $day_of_week = date('D', $first_day); //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } //We then determine how many days are in the current month $days_in_month = cal_days_in_month(0, $month, $year); //Here we start building the table heads echo "<table>"; echo "<tr><th colspan=\"7\" class=\"title\"> $title $year </th></tr>"; echo '<tr><td class="dayOfWeek">Sunday</td><td class="dayOfWeek">Monday</td><td class="dayOfWeek">Tuesday</td><td class="dayOfWeek">Wendsday</td><td class="dayOfWeek">Thursday</td><td class="dayOfWeek">Friday</td><td class="dayOfWeek">Saturday</td></tr>'; //This counts the days in the week, up to 7 $day_count = 1; echo "<tr>"; //first we take care of those blank days while ( $blank > 0 ) { echo "<td> </td>"; $blank = $blank-1; $day_count++; } //sets the first day of the month to 1 $day_num = 1; $dbc = mysql_connect('rwddesign.com:3306', 'rwddesi1_bobby31', '******'); mysql_select_db('rwddesi1_test'); //count up the days, untill we've done all of them in the month while ( $day_num <= $days_in_month ) { $query = "SELECT * FROM events WHERE date='$year-$month-$day_num'"; if ($r = mysql_query($query, $dbc)) { while ($row = mysql_fetch_array($r, $dbc)) { $event_name = "{$row['eventName']}"; } } else { print 'error' . mysql_error() . 'from' . $query . ''; } echo "<td> $day_num $event_name</td>"; $day_num++; $day_count++; $event_name = ""; //Make sure we start a new row every week if ($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } //Finaly we finish out the table with some blank details if needed while ( $day_count >1 && $day_count <=7 ) { echo "<td> </td>"; $day_count++; } //Close column and table echo "</tr></table>"; //print "$query"; ?>
  11. well crap the query seems to be working right and $day_num is changing to the right day in the query. I wonder if it dose not find a date on the first try if it stops running? Could that be it any ideas. I am going to go back and look at my while and see if it stops running if nothing comes up in the database for the 1st day of the month.
  12. Ok I am getting very very close to having this let me do some explaining. It has something to do with my $day_num variable. Which is the varable that is printed to display the number of the date on the calendar I am also trying to use it to retive my info from the database like so: $query = "SELECT * FROM events WHERE date='$year-$month-$day_num'"; which the above code dose nothing. Now I have an event on the 20 of this mounth that is just a test. if I replace $day_num with 20 in my query it works and desplayes that on every date. Now the $day_num variable prints the dates to the screen in the calendar and then increasing and keeps moving so it should change my $day_num variable to the write number but dose not seem to be working that way. My question is why when I put the actualy number 20 in the query it workes but a variable set to 20 will not? Also here is my code as it currently stands may have changed some things as I have been working through this. <?php //CSS style print '<link href="eventMain.css" rel="stylesheet" type="text/css" />'; //This gets today's date $date = time (); //This puts the day, month, and year in seperate variables $day = date('d', $date); $month = date('m', $date); $year = date('Y', $date); //Here we generate the first day of the month $first_day = mktime(0,0,0,$month, 1, $year); //This gets us the month name $title = date('F', $first_day); //Here we find out what day of the week the first day of the month falls on $day_of_week = date('D', $first_day); //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } //We then determine how many days are in the current month $days_in_month = cal_days_in_month(0, $month, $year); //Here we start building the table heads echo "<table>"; echo "<tr><th colspan=\"7\" class=\"title\"> $title $year </th></tr>"; echo '<tr><td class="dayOfWeek">Sunday</td><td class="dayOfWeek">Monday</td><td class="dayOfWeek">Tuesday</td><td class="dayOfWeek">Wendsday</td><td class="dayOfWeek">Thursday</td><td class="dayOfWeek">Friday</td><td class="dayOfWeek">Saturday</td></tr>'; //This counts the days in the week, up to 7 $day_count = 1; echo "<tr>"; //first we take care of those blank days while ( $blank > 0 ) { echo "<td> </td>"; $blank = $blank-1; $day_count++; } //sets the first day of the month to 1 $day_num = 1; $dbc = mysql_connect('rwddesign.com:3306', 'rwddesi1_****', '******'); mysql_select_db('rwddesi1_****'); $query = "SELECT * FROM events WHERE date='$year-$month-$day_num'"; //count up the days, untill we've done all of them in the month while ( $day_num <= $days_in_month ) { if ($r = mysql_query($query, $dbc)) { while ($row = mysql_fetch_array($r, $dbc)) { $event_name = "{$row['eventName']}"; } } else { print 'error' . mysql_error() . 'from' . $query . ''; } echo "<td> $day_num $event_name </td>"; $day_num++; $day_count++; //Make sure we start a new row every week if ($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } //Finaly we finish out the table with some blank details if needed while ( $day_count >1 && $day_count <=7 ) { echo "<td> </td>"; $day_count++; } //Close column and table echo "</tr></table>"; print "$event_name"; ?> Any advice? And plesae explain so I may learn. Thanks.
  13. I don't belive that is it. My code is not reaching that point in the script and what that line is saying is that if $day_count is greater than one or equal to or less than 7 it will add a cell to the table and increse $day_count by one so once $day_count got to 8 it would quit running. I think it has to do with my loop that is running the query but still working on it. Anything else you can think of? Thanks
  14. Ok I tried combining the two codes and now I am getting this error: Fatal error: Maximum execution time of 30 seconds exceeded in /home/rwddesi1/public_html/1stCalendar.php on line 63 it seems to start working untill the first day of the month is to be printed. any ideas? <?php //CSS style print '<link href="eventMain.css" rel="stylesheet" type="text/css" />'; //This gets today's date $date = time (); //This puts the day, month, and year in seperate variables $day = date('d', $date); $month = date('m', $date); $year = date('Y', $date); //Here we generate the first day of the month $first_day = mktime(0,0,0,$month, 1, $year); //This gets us the month name $title = date('F', $first_day); //Here we find out what day of the week the first day of the month falls on $day_of_week = date('D', $first_day); //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } //We then determine how many days are in the current month $days_in_month = cal_days_in_month(0, $month, $year); //Here we start building the table heads echo "<table>"; echo "<tr><th colspan=\"7\" class=\"title\"> $title $year </th></tr>"; echo '<tr><td class="dayOfWeek">Sunday</td><td class="dayOfWeek">Monday</td><td class="dayOfWeek">Tuesday</td><td class="dayOfWeek">Wendsday</td><td class="dayOfWeek">Thursday</td><td class="dayOfWeek">Friday</td><td class="dayOfWeek">Saturday</td></tr>'; //This counts the days in the week, up to 7 $day_count = 1; echo "<tr>"; //first we take care of those blank days while ( $blank > 0 ) { echo "<td> </td>"; $blank = $blank-1; $day_count++; } //sets the first day of the month to 1 $day_num = 1; //count up the days, untill we've done all of them in the month while ( $day_num <= $days_in_month ) { $dbc = mysql_connect('rwddesign.com:3306', 'rwddesi1_*******', '******'); mysql_select_db('rwddesi1_test'); $query = "SELECT * FROM events WHERE date='$year-$month-$day_num'"; if ($r = mysql_query($query)) { while ($row = mysql_fetch_array($r)) { //print "{$row['eventName']}"; echo "<td> $day_num {$row['eventName']} </td>"; $day_num++; $day_count++; } } else { print 'error' . mysql_error() . 'from' . $query . ''; } mysql_close(); //Make sure we start a new row every week if ($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } //Finaly we finish out the table with some blank details if needed while ( $day_count >1 && $day_count <=7 ) { echo "<td> </td>"; $day_count++; } //Close column and table echo "</tr></table>";
×
×
  • 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.