Jump to content

steviemac

Members
  • Posts

    94
  • Joined

  • Last visited

    Never

Everything posted by steviemac

  1. Hello, I have a form where individuals can update there personal information that is already stored in a database, i.e name, address, phone number etc. There are several fields they can update. Right now it sends an email to the owner that an individual has updated their records, and sends all the fields that are in the table. Is it possible to let the owner be notified by email which individual field was updated? Example their phone number has changed they make the update and the owner gets an e-mail with just that field update. I hope I explained myself properly. Thank you in advance.
  2. I want to be able to update a table in a database that also sends a file to a folder on the server. It will send the file to the server but will not update the table. This is my code <?php include "dbmembers.php"; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 40000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } if (file_exists("members_images/" . $_FILES["file"]["name"])) { echo "<B>This name "; echo $_FILES["file"]["name"] . " that you have named your file already exists on the server. Please rename it and upload it again.</B>"; } else { (mysql_query("UPDATE allmembers set photo = '".mysql_real_escape_string($_POST['file']['name'])."' where id = '".mysql_real_escape_string($_POST['id'])."'") or die(mysql_error())) ; move_uploaded_file($_FILES["file"]["tmp_name"], "members_images/" . $_FILES["file"]["name"]); echo "Your file " . $_FILES["file"]["name"] . " has been successfully uploaded to the server."; } } else { echo "Invalid file format. You file is not a .gif or .jpg extension or is to large in size."; } ?> Thank you for your help
  3. I want it to both. Page 1 would have two columns, 0-4 and 5-9 Page 2 would have 2 columns 9-14 and 15-19 and so on and so on until all the rows are displayed
  4. Hello, I want to be able to paginate my rows in two columns on one page i.e. Column 1 Column 2 row 0 row 5 row 1 row 6 row 2 row 7 row 3 row 8 row 4 row 9 <<Prev 12345 Next>> This is the code I use. I found it and on Google, tweaked it and it works great. <?php include 'dbmembers.php'; if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $max_results = 30; $from = (($page * $max_results) - $max_results); $sql = mysql_query("SELECT * FROM table WHERE status='active' LIMIT $from, $max_results"); while($row = mysql_fetch_array($sql)){ echo "$row[last_name] $row[first_name] } $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM allmembers WHERE status='active'"),0); $total_pages = ceil($total_results / $max_results); echo "<p align=\"center\">Select a Page<br />"; if($page > 1){ $prev = ($page - 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\">« Previous </a>"; } for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; } } if($page < $total_pages){ $next = ($page + 1); echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next »</a>"; } echo "</p>"; ?> Thanks in advance for any help. I have been working on this for a bout a week on and off with no success.
  5. Thanks for the help. The problem was I was not encripting the password
  6. I'm still getting a blank screen. My password is stored as MD5 (). Do I have to make the form password convert to md5 also. I think that is my problem.
  7. From the form <form action="loginck.php" method="POST"> <P> Username <input type="text" name="userName"> Password <input type="password" name="userPass"></P> <P><input type="submit" value="Login" name="submit"></P> </form> I also changed the isset to if(isset ( $_POST['submit'])); I'm still not "reading" the table!!
  8. I am trying to query a table where the column status=0 they are not authorized to view and if status=1 they are authorized to view. The problem is the code is not executing. I am getting a blank page. This is my code. I am new to the PHP world and I'm not sure whar I am doing wrong. Thank you in advance <?PHP include 'dbmembers.php' ?> <?php $userName = $_POST['userName']; $userPass = $_POST['userPass']; ?> <?PHP ini_set('display_errors', 1) ; error_reporting(E_ALL); if(isset ($submit)) { $data = "SELECT * FROM table WHERE userName = '$userName' AND userPass = '$userPass'"; //this is user name and password $result = mysql_query($data) or die(mysql_error()); while($record = mysql_fetch_array($result)) { if ($record['status'] = 0) //they are waiting approval { echo "<P>You are not authorized<br>"; } elseif ($record['status'] = 1)//they have been approved { redirect('members/index.php'); } } } ?>
  9. Sorry, I'm not sure how to code the login script username =$username, and password=$password where status=1 if status = 1 redirect whatever.php else echo Not yet authorized Does that seem right?
  10. This is what I feel should happen. When they sign up they are inserted into the table and I believe they would be given a status of 0=not approved and 1=approved. I want the central admin to get a email that there is someone pending (not a problem). They would either accept or delete. One form would update and one form would delete from table. Once done it would generate email to new user stating they have been accepted or denied. Not really a problem. When they log in how would I show their status is =1 approved?
  11. I have members area that people can sign up for. What I need is before they can log on they have to be approved by a central administrator. I under stand the status in the table. What I'm looking for is a tutorial to point me in the right direction. Thanks in advance
  12. Hello, I an trying to get the SELECT and SUM function to work. I would like a column to add all the numbers in the column and get a total. If a user trys to update the table and that total is at a pre determined number it will echo one thing if not it will echo something else. This is my code. They enter their unique registration number and it will only display that row Update <?php echo "" .COURSE_NAME; ?> </h3> <form name="search" method="post" action="<?=$PHP_SELF?>" onSubmit="return validateCompleteForm(this);"> <P align="center"><b>Enter Course Registration Number:</b> <input type="text" name="find" id="find" /> <input type="hidden" NAME="field" VALUE="[color=red]registration[/color]"> <input type="hidden" NAME="Seats" > <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </P> </form> <P>Forgot you registration code? <a href="forgotregistration.php">Go here</a></P> <center><img src="../../images/blkline.jpg"></center> <?php include '../db_config.php'; ?> <?php error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('track_errors', true); //This is only displayed if they have submitted the form if ($searching == "yes") { echo "<h3 align=\"center\">Results</h3>"; if ($find == "") { echo "<p>You forgot to enter a search term</p>"; exit; } $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); $data = mysql_query("SELECT *, SUM(Seats) as totalSeats FROM " . USERS_TABLE . " WHERE upper($field) ='$find' GROUP BY registration ") or die('<hr />MySQL Error: ' .mysql_error(). '<hr />'); while($result = mysql_fetch_array($data)) { if ($result['totalSeats'] == 25[color=red])//this would be the max and they would get the following [/color] { echo "<form action=\"updateck\" \" name=\"update\" method =\"POST\" >"; echo "<table align=\"center\" width=\"630\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" class=\"tblwhi\"><tr>"; echo "<tr><td class=\"thetag\">Seats Requested</td></tr>"; echo "<td class='thevalue'><P align=\"center\">$result[seats]</p> <input type=\"hidden\" size=\"30\" name=\"Seats\" value=\"$result[seats]\" /></td></tr>"; echo "<tr><td colspan=\"\"><input type=\"submit\" name=\"submit\" value=\"Update Selected\" /></td></tr>"; echo "<tr><td colspan=\"\"><center><img src=\"../../images/blkline.jpg\"></center></td></tr></table>\n"; echo "</form>\n"; } else{ echo $result['totalSeats']; [color=red]// all I'm getting is the seats from the one row instead of the whole column[/color] echo "<form action=\"updateck\" \" name=\"update\" method =\"POST\" >"; echo "<table align=\"center\" width=\"630\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" class=\"tblwhi\"><tr>"; echo "<tr><td class=\"thetag\">Seats Requested</td></tr>"; echo "<tr><td class='thevalue'><P align=\"center\"><select name=\"Seats\" /><option>$result[seats]</option><option>1</option><option>2</option></select></p></td></tr>"; echo "<tr><td colspan=\"\"><input type=\"submit\" name=\"submit\" value=\"Update Selected\" /></td></tr>"; echo "<tr><td colspan=\"\"><center><img src=\"../../images/blkline.jpg\"></center></td></tr></table>\n"; echo "</form>\n"; } } $anymatches = mysql_num_rows($data); if ($anymatches == 0) { echo "<P>Sorry, but we can not find an entry to match your query<br><br></P>"; } echo "<P><b>Searched For:</b> " . $find; echo "</p>"; } ?> I'm pretty much at the end of my rope. I have been at this for two days with no success. Thank you for any help.
  13. I saw that and fixed it. I am still having the problem.
  14. In the form they input their registration number in. <form name="search" method="post" action="<?=$PHP_SELF?>"> <P align="center"><b>Enter Course Registration Number:</b> <input type="text" name="find" id="find" /> <input type="hidden" NAME="field" VALUE="registration"> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </P> </form>
  15. I am trying to do a search of a db by a unique registration number. In this table are seats that can be selected to attend a course. I want the results to echo Sum(Seats) = 25 than they can not select any more seats and if the Sum(Seats) <= 24 they can add a seat. This is my code <?php error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('track_errors', true); if ($searching =="yes") { echo "<h3 align=\"center\">Results</h3>"; if ($find == "") { echo "<p>You forgot to enter a search term</p>"; exit; } mysql_connect("localhost", "xxxx", "xxxx") or die(mysql_error()); mysql_select_db("xxxx") or die(mysql_error()); $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); $data = mysql_query("SELECT registration, SUM(Seats) as totalSeats FROM ".USERS_TABLE." WHERE upper($field) ='$find' "); $result = mysql_query($data) or die('<hr />MySQL Error: ' .mysql_error(). '<hr />'); { while($record = mysql_fetch_array($results)) if ($record['totalSeats'] == 25){ echo "<form action=\"updateck\" \" name=\"update\" method =\"POST\" >"; echo "<table align=\"center\" width=\"630\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" class=\"tblwhi\"><tr>"; echo "<tr><td class=\"thetag\" colspan=\"3\"><B>$result[Course] to be updated <input type=\"hidden\" size=\"30\" name=\"Course\" value=\"$result[Course]\" /></td></tr>"; echo "<tr><td class=\"thetag\">Seats Requested</td></tr>"; echo "<tr><td class='thevalue'>$result[seats] <input type=\"hidden\" size=\"30\" name=\"Seats\" value=\"$result[seats]\" /></td></tr>"; } else if ($record['totalSeats'] <= 24){ echo "<form action=\"updateck\" \" name=\"update\" method =\"POST\" >"; echo "<table align=\"center\" width=\"630\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" class=\"tblwhi\"><tr>"; echo "<tr><td class=\"thetag\" colspan=\"3\"><B>$result[Course] to be updated <input type=\"hidden\" size=\"30\" name=\"Course\" value=\"$result[Course]\" /></td></tr>"; echo "<tr><td class=\"thetag\">Seats Requested</td></tr>"; echo "<tr><td class='thevalue'><select name=\"Seats\" /><option>$result[seats]</option><option>1</option><option>2</option><option>3</option></select></td></tr>"; } } $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "<P>Sorry, but we can not find an entry to match your query<br><br></P>"; } echo "<P><b>Searched For:</b> " .$find; echo "</p>"; } ?> I am getting the Query WasEmpty error. I am not sure what I am doing wrong here. I'm still very new to PHP MYSQL and I appreciate any help.
  16. Since we do it manually everyone goes in the same table. The main reason is the courses repeat through out the year. If they are on the waiting list in April they are given a seat at the next course, so we keep the info in the table of the course. Hope it helps This is the columns mysql_query("CREATE TABLE $nametable( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), registration VARCHAR(30), Course VARCHAR(255), Seats INT, Student_1_Name VARCHAR(255), Status_Student_1 VARCHAR(255), doe_1 VARCHAR(255),///date of employment Student_2_Name VARCHAR(255), Status_Student_2 VARCHAR(255), doe_2 VARCHAR(255), Student_3_Name VARCHAR(255), Status_Student_3 VARCHAR(255), doe_3 VARCHAR(255), Agency VARCHAR(255), Contact_Person VARCHAR(255), Agency_Phone VARCHAR(255), fax VARCHAR(255), email_address VARCHAR(255), date TIMESTAMP NOT NULL)") or die(mysql_error()); echo "Table Created!";
  17. This is the script. All it does is tell them they canceled and sends a email to the office manager. The office manager then sends an email to the next on the waiting list. I just wanted to ease the process and try toautomate it <?php error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('track_errors', true); //Connect to DB $db = mysql_connect("localhost", "xxxxx", "xxxx"); mysql_select_db("xxxx"); if($_POST['submit']) { $result = mysql_query("DELETE FROM ".USERS_TABLE." WHERE id = '".$_POST['id']."'") or die(mysql_error()); echo "Your course seat has been canceled"; } else { echo 'You didnt enter any data'; } ?> email code here
  18. I have an on line registration for a trade school. Eventually the classes become full and the students go to a waiting list. Here is my question. If someone cancels a class, can I (with the help of code) take them from a waiting list table and and put them in the active table and then generate a email to let them know they are no longer on the waiting list and can attend the course? Even using one table with a form field that is "waiting" with a response in it. Now if someone cancels their seat the first waiting person gets a auto email saying they are accepted to the course and the "waiting" field has a different response. Something to either effect. Thank you in advance for any input
  19. I did that and I solved it. The problem was in the origional form. I did not give id a value in the form so it did not know what row to update. I'm a rookie at this so sometimes the simple things catch me. The silver lining is I learned about my mysql_real_escape_string(). Thank you for you time and patiences.
  20. OK this is what I have now and still not updating ??? <?php error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('track_errors', true); //Connect to DB $db = mysql_connect("localhost", "x", "xx"); mysql_select_db("xx"); if(isset ($_POST['submit'])) { //CHANGE TABLE NAME $result = "UPDATE ActiveMembers SET last_name='".mysql_real_escape_string($_POST['last_name'])."', first_name='".mysql_real_escape_string($_POST['first_name'])."', Rank = '".mysql_real_escape_string($_POST['Rank'])."', Agency = '".mysql_real_escape_string($_POST['Agency'])."', Address = '".mysql_real_escape_string($_POST['Address'])."', CSZ = '".mysql_real_escape_string($_POST['CSZ'])."', Phone = '".mysql_real_escape_string($_POST['Phone'])."', Fax = '".mysql_real_escape_string($_POST['Fax'])."', email = '".mysql_real_escape_string($_POST['email'])."', ResidenceAddress = '".mysql_real_escape_string($_POST['ResidenceAddress'])."', RCSZ = '".mysql_real_escape_string($_POST['RCSZ'])."', ResidencePhone = '".mysql_real_escape_string($_POST['ResidencePhone'])."', id_number = '".mysql_real_escape_string($_POST['id_number'])."' WHERE id = '$id'"; mysql_query($result) or die(mysql_error()); // echo out the query if (mysql_affected_rows()==1){ echo Success"; } else { echo "Failure"; } } ?> I am getting the failure echo??????????
  21. I tried it the way described and it still will not update.
×
×
  • 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.