Jump to content

Eggzorcist

Members
  • Posts

    214
  • Joined

  • Last visited

    Never

Everything posted by Eggzorcist

  1. So this is the current updated code. I'm not getting any sql error, but it hops to else statement when it really should pass the if statement... any ideas? $eid = $_GET['ID']; $euser = $_SESSION['USER']; $query = mysql_query("SELECT * FROM events WHERE id = '$eid' and user = '$euser'") or die(mysql_error()); if (mysql_num_rows($query) == 1){ $editinfo = mysql_fetch_assoc($query); } else { echo "You cannot edit that particular event, you may only edit events you've created."; } thanks,
  2. I'm not getting the error anymore, but it still doesn't pass when it's suppose to...
  3. Now I'm getting the Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /Users/JPFoster/Sites/Event_Profiler/editevent.php on line 16 I'm having trouble with this argument, sometimes this occurs and other time it doesn't... I'm really not sure I'm getting that warning...
  4. It seems like my sql command isn't correct as it's not obtaining the correct information. As it always outputs the else command when it should show the if statement. $_GET['ID'] = $eid; $_SESSION['USER'] = $euser; $query = mysql_query("SELECT * FROM events WHERE id = '{$eid}' and user = '{$euser}'"); if (mysql_num_rows($query) >= 1){ $editinfo = mysql_fetch_assoc($query); } else { echo "You cannot edit that particular event, you may only edit events you've created."; } Any idea of syntax or problematic things in this code? Any help will be greatly appreciated.
  5. Perfect, thanks to you both! Will know this for my current and future applications. Thanks a lot to you both.
  6. I'm trying to create a query where it matches both the username and the date - so that if the date is 5 days away or shorter it doesn't show, but if it's 6 days or more away it will show it those queries. My sql field uses the date datatype and a example of that field is: "2009-08-12" Here's my function and query... $filtertime = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+5, date("Y"))); $query = "SELECT * FROM events WHERE user = '".$user."' and fromslashes > '.$filtertime.'" The problem is that it shows all where the user = $user and disregards the fromslahes > than $filtertime... Any ideas?
  7. And if I'm doing something like date("Y-m-d") how can make that date 5 days later than it actually is? And how would it react with the month's field if the day is the 30th or 29th with the + 5? thanks
  8. Is date() the user's date from his PC or is it taken from the server? How about time() too? Thanks
  9. I am currently using the dates datatype for that field. I don't really understand this query, why are we addslahes between? and I don't see how we are comparing the field "fromslahes" to the current date + 5. shoudn't it be some like: fromslahes > ".date("Y-m-d H:i:s", strtotime("+ 5 days"))."' or something alike? I'm a bit confused...
  10. I've always had extreme trouble comparing dates or times. For the application I'm currently building I need to be able to make a sql query which will compare the date and time. So with this query "SELECT * FROM events WHERE user = '".$_SESSION['USER']."'"; I want to add a AND statement which will check the sql field "fromslashes" (which for eg. is set like "08/03/2009" format) and will make sure that that date is 5 days later than the current date that it is now. So it only displays if that day is 5 days later than todays date or earlier. How would I be going about to form this statement? Thanks!
  11. How can I use header() function when I'm using it in a function file without getting an error? Any tips or tricks?
  12. I'm not sure what's causing this, but I'm getting this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JPFoster','Club name ID' ,Tester', '08/06/2009', 'Thursday, 6 August, 2009', '22' at line 3 Here's my query "INSERT INTO events (user, clubname, name, fromslashes, fromdisplay, fromtime, toslashes, todisplay, totime, quickdescription, pagedescription, status) VALUES (''".$_GET['USER']."','".$_GET['clubname']."' ,".$data['eventTitle']."', '".$data['from1']."', '".$data['from2']."', '".$data['fromtime']."', '".$data['to1']."', '".$data['to2']."', '".$data['totime']."', '".$data['quickDesc']."', '".$data['description']."', '".$status."')"
  13. I've actually created a GET for that page so it uses the GET session ID instead of the session.
  14. I'm trying to make an application which would need the user to stay logged in for a long period of time. As there are a long fields to fill out and I'm wondering wether $_SESSIONS is what I should be using or should I be using $_COOKIES or something that I'm not aware of... I just don't want a user to type a long piece of data and try to submit it but their sessions timed-out any solutions? Thanks
  15. so if it's checked it will output "1" and if left it'll be "0"? or true or false?
  16. What kind of value does a check box have when it's submitted checked or submitted unchecked? Thanks
  17. Is this perhaps because I put the ID field as the key auto increment?
  18. I'm not sure why I am getting this error, it was working before the first entry I put in... error mesasge. Duplicate entry '0' for key 1
  19. mysql_query("INSERT INTO events (name, fromslashes, fromdisplay, fromtime, toslashes, todisplay, totime, quickdescription, pagedescription, sameday, status) VALUES ('".$data['eventTitle']."', '".$data['from1']."', '".$data['from2']."', '".$data['fromtime']."', '".$data['to1']."', '".$data['to2']."', '".$data['totime']."', '".$data['quickDesc']."', '".$data['description'].", '".$sameday."', '".$status."')")
  20. I'm trying to enter an integer to my database but I get this error. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1', '0'')' at line 3 I'm not sure why I am getting this error..
  21. One error is delt with but I'm still getting the: Column count doesn't match value count at row 1
  22. Oh I forgot to post it the entire area. the function calling is done by: if($_POST){ $inputFieldNamesToDb = array('eventTitle' => 'title', 'from1' => 'datepicker1', 'from2' => 'alternative1', 'fromtime' => 'timestart', 'to1' => 'datepicker1', 'to2' => 'alternative2', 'totime' => 'timefinish', 'quickDesc' => 'Qdescription', 'description' => 'elm1'); foreach($inputFieldNamesToDb as $dbField => $postField) { $data[$dbField] = $_POST[$postField]; } addeventToPending($_POST['title'], $_POST['datepicker1'], $_POST['alternative1'], $_POST['timestart'], $_POST['datepicker1'], $_POST['alternative2'], $_POST['timefinish'], $_POST['Qdescription'], $_POST['elm1']); }
  23. function function addeventToPending($data){ foreach($data as $key => $value) { $data[$key] = mysql_real_escape_string($value); } if(!mysql_query("INSERT INTO events (name, fromslashes, fromdisplay, fromtime, toslashes, todisplay, totime, quickdescription, pagedescription, sameday, status) VALUES ('".$data['eventTitle']."', '".$data['from1']."', '".$data['from2']."', '".$data['fromtime']."', '".$data['to1']."', '".$data['to2']."', '".$data['totime']."', '".$data['quickDesc']."', '".$data['description']."')")) { die(mysql_error()); } echo "Your event was put up for approval."; } Form Area: if($_POST){ $inputFieldNamesToDb = array('eventTitle' => 'title', 'from1' => 'datepicker1', 'from2' => 'alternative1', 'fromtime' => 'timestart', 'to1' => 'datepicker1', 'to2' => 'alternative2', 'totime' => 'timefinish', 'quickDesc' => 'Qdescription', 'description' => 'elm1'); foreach($inputFieldNamesToDb as $dbField => $postField) { $data[$dbField] = $_POST[$postField]; }
×
×
  • 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.