-
Posts
53 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by njfrlng
-
Yes, no sense worrying about all the other data if i cant get anything to work.
-
I barely know what I am doing, lol. My understanding/thought process is: My view.php grabs all the info in my database based on the column role. It then drops the employees first and last name and their id from the database into a table and also gives me the option to view/edit/delete that employee. If I click edit, it redirects me to my edit_form.php file and uses the ID from the table ( via adding this to the url ?id=$row[id]) The edit_form.php has all the forms prepopulated with the data from the database based on the id passed along from the ID i selected in view.php I edit the data and click update which should update the data. However it doesnt.
-
I'm making a simple data entry page where you can add employees to a database. I think have it so you can view all employees in a table, and either view them, edit them, or delete them. View/Delete work fine. However, my edit doesn't seem to work at all. I have the edit page so that it pulls the current data for the selected employee. But when you change the data and click submit the information does not get updated. So my question is: Why is my update.php not updating the database with the edited data? Page 1 - View.php <?php $BASE_PATH = 'C:\xampp\htdocs\OGS'; include_once($BASE_PATH . "\includes\layouts\header.php"); ?> <?php mysql_connect('localhost', 'root', ''); mysql_select_db('ogs'); ?> <div id="main"> <div id="subnavigation"> <?php include_once($BASE_PATH . "\mods\main_menu\index.html");?> </div> <div id="page"> <p><b>View Employee</b></p> </br> <?php $con=mysqli_connect("localhost","root","","ogs"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM people WHERE role=1"); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Id</th> <th>View Employee</th> <th>Edit Employee</th> <th>Delete Employee</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['first_name'] . "</td>"; echo "<td>" . $row['last_name'] . "</td>"; echo "<td>" . $row['id'] . "</td>"; echo "<td><a href=\"view_form.php?id=$row[id]\"><center>View</center></a></td>"; echo "<td><a href=\"edit_form.php?id=$row[id]\"><center>Edit</center></a></td>"; echo "<td><a href=\"delete.php?id=$row[id]\"><center>Delete</center></a></td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?> </div> </div> </div> Page 2 - Edit_form.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Form Edit Data</title> </head> <body> <?php $BASE_PATH = 'C:\xampp\htdocs\OGS'; include_once($BASE_PATH . "\includes\layouts\header.php"); ?> <div id="main"> <div id="subnavigation"> <?php include_once($BASE_PATH . "\mods\main_menu\index.html");?> </div> <div id="page"> <br><br> <table border=1> <tr> <td align=center>Update Employee Information</td> </tr> <tr> <td> <table> <?php mysql_connect('localhost', 'root', ''); mysql_select_db('ogs'); ?> <?php $emp_id= ($_GET["id"]); $id = 0; $firstName = ''; $lastName = ''; $sql = "SELECT * FROM people WHERE id='$emp_id' LIMIT 1"; $result = mysql_query($sql); $row_people = mysql_fetch_array($result); if(!empty($row_people)) { $id = $row_people['id']; $first_name = $row_people['first_name']; $last_name = $row_people['last_name']; } ?> <form method="post" action="update2.php"> <input type="text" name="id" value="<?php echo $id; ?>"> <fieldset> <legend><b>Name</b></legend> First Name:<input type="text" name="first_name" size="20" value="<?php echo "$row_people[first_name]"; ?>"> Last Name:<input type="text" name="last_name" size="40" value="<?php echo "$row_people[last_name]"; ?>"> </fieldset> <br><br> <fieldset> <legend><b>Contact Information</b></legend> Town:<input type="text" name="town" size="20" value="<?php echo "$row_people[town]"; ?>"> Address:<input type="text" name="address" size="40" value="<?php echo "$row_people[address]"; ?>"> Province: <?php $prov_sql = "SELECT id, province FROM ref_provinces ORDER BY province ASC"; $prov_result = mysql_query($prov_sql); echo "<select name='province'>"; $existing_prov_id = $row_people['province']; while ($row_prov = mysql_fetch_array($prov_result)) { // Check if the existing id is the same as the current id we are displaying // If it is, set the selected attribute if($existing_prov_id == $row_prov['id']) echo "<option selected='selected' value='" . $row_people['id'] . "'>" . $row_prov['province'] . "</option>"; else echo "<option value='" . $row_prov['id'] . "'>" . $row_prov['province'] . "</option>"; } echo "</select>"; ?> Postal Code:<input type="text" name="postal_code" size="40" value="<?php echo "$row_people[postal_code]"; ?>"> <br><br> Home Phone:<input type="text" name="home_phone" size="20" value="<?php echo "$row_people[home_phone]"; ?>"> Cell Phone:<input type="text" name="cell_phone" size="40" value="<?php echo "$row_people[cell_phone]"; ?>"> </fieldset> <br><br> <fieldset> <legend><b>Emergency Contact</b></legend> Emergency Contact Name:<input type="text" name="first_name" size="20" value="<?php echo "$row_people[first_name]"; ?>"> Emergency Contact Number:<input type="text" name="last_name" size="40" value="<?php echo "$row_people[last_name]"; ?>"> </fieldset> <br><br> <fieldset> <legend><b>Work Information</b></legend> Role: <?php $role_sql = "SELECT id, role FROM ref_role ORDER BY role ASC"; $role_result = mysql_query($role_sql); echo "<select name='role'>"; $existing_role_id = $row_people['role']; while ($row_role = mysql_fetch_array($role_result)) { // Check if the existing id is the same as the current id we are displaying // If it is, set the selected attribute if($existing_role_id == $row_role['id']) echo "<option selected='selected' value='" . $row_people['id'] . "'>" . $row_role['role'] . "</option>"; else echo "<option value='" . $row_role['id'] . "'>" . $row_role['role'] . "</option>"; } echo "</select>"; ?> Employer: <?php $company_sql = "SELECT id, company_name FROM companies ORDER BY company_name ASC"; $company_result = mysql_query($company_sql); echo "<select name='company_works_for'>"; $existing_company_name_id = $row_people['company_works_for']; while ($row_company = mysql_fetch_array($company_result)) { // Check if the existing id is the same as the current id we are displaying // If it is, set the selected attribute if($existing_company_name_id == $row_company['id']) echo "<option selected='selected' value='" . $row_people['id'] . "'>" . $row_company['company_name'] . "</option>"; else echo "<option value='" . $row_company['id'] . "'>" . $row_company['company_name'] . "</option>"; } echo "</select>"; ?> <br><br> Department: <?php $dept_sql = "SELECT id, department FROM ref_department ORDER BY department ASC"; $dept_result = mysql_query($dept_sql); echo "<select name='department'>"; $existing_dept_id = $row_people['department']; while ($row_dept = mysql_fetch_array($dept_result)) { // Check if the existing id is the same as the current id we are displaying // If it is, set the selected attribute if($existing_dept_id == $row_dept['id']) echo "<option selected='selected' value='" . $row_people['id'] . "'>" . $row_dept['department'] . "</option>"; else echo "<option value='" . $row_dept['id'] . "'>" . $row_dept['department'] . "</option>"; } echo "</select>"; ?> Position: <?php $position_sql = "SELECT id, position FROM ref_positions ORDER BY position ASC"; $position_result = mysql_query($position_sql); echo "<select name='position'>"; $existing_position_id = $row_people['position']; while ($row_position = mysql_fetch_array($position_result)) { // Check if the existing id is the same as the current id we are displaying // If it is, set the selected attribute if($existing_position_id == $row_position['id']) echo "<option selected='selected' value='" . $row_people['id'] . "'>" . $row_position['position'] . "</option>"; else echo "<option value='" . $row_position['id'] . "'>" . $row_position['position'] . "</option>"; } echo "</select>"; ?> <br><br> Is Supervisor?: <input type="radio" name="is_supervisor" value="<?php echo "$row_people[is_supervisor]"; ?>"> Yes <input type="radio" name="is_supervisor" value="<?php echo "$row_people[is_supervisor]"; ?>"> No <br><br> Is Active?: <input type="radio" name="active_employee" value="<?php echo "$row_people[active_employee]"; ?>"> Yes <input type="radio" name="active_employee" value="<?php echo "$row_people[active_employee]"; ?>"> No <br><br> Start Date:<input type="text" name="start_date" size="40" value="<?php echo "$row_people[start_date]"; ?>"> </fieldset> <input name="update" type="submit" id="update" value="Update"> </form> </div> </div> </body> </html> Page 3 - Update.php <?php $BASE_PATH = 'C:\xampp\htdocs\OGS'; include_once($BASE_PATH . "\includes\layouts\header.php"); ?> <div id="main"> <div id="subnavigation"> <?php include_once($BASE_PATH . "\mods\main_menu\index.html");?> </div> <div id="page"> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="ogs"; // Database name $tbl_name="people"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $emp_id= $_POST["id"]; $first_name = $_POST['first_name']; $last_name = $_POST["last_name"]; // update data in mysql database $sql="UPDATE $tbl_name SET first_name='$first_name', last_name='$last_name' WHERE id='$emp_id' LIMIT 1"; $result=mysql_query($sql); // if successfully updated. if($result){ echo "Successful"; echo "<BR>"; } else { echo "ERROR"; } ?> </div> </div> Please don't mind the mess! I am also aware I leave myself wide open for sql injection and other problems. But right now this is just on my local machine and will not be accessible by anyone else. I intend to go back and fix things as I learn more.
-
No comment... lol never used any of it yet.
-
opps sorry, didnt notice the MVC part, considering I dont know what MVC is, Im going to go with no, lol
-
I signed up at Lynda.com and did a procedural php course, it was great! (Especially since I've never used php, and pretty much have no programming experience.) This is the end result: Front End: http://nicfurlong.com/public/ Back End: http://nicfurlong.com/public/login.php Login: test Password: test1 It's nothing fancy, but all subjects/pages are editable. You can create/edit admins as well. Currently making a front end user registration system on my own, almost have it complete! :D I'm hoping to turn it into a useable website/database for my full time job. But for now, I'm just experimenting and learning.
-
This thread has been closed.
-
Personally I'd do the following: Change the font, align it with the left side of the input box. and probably position it a 10 or so pixels lower. Remove the little menu with the checkerplate background. Instead have text links within the header on the far right side of the header. Remove the gun in the header. Email me the PSD and i can show you what I mean - [email protected]
-
awesome! Can't wait to try
-
Am I missing something here... How can you in your right mind sell a game you've based ENTIRELY on another.... CrimeCity Login Area [ATTACH=CONFIG]1366[/ATTACH] TornCity Login Ar [ATTACH=CONFIG]1367[/ATTACH] CrimeCity Crimes [ATTACH=CONFIG]1368[/ATTACH] TornCity Crimes [ATTACH=CONFIG]1369[/ATTACH] CrimeCity Gym [ATTACH=CONFIG]1370[/ATTACH] TornCity Gym [ATTACH=CONFIG]1371[/ATTACH] I dunno, sorry if I'm missing something here, but there is hardly any attempts to differentiate yourself from TornCity... I could go on and on about the similarities but that would take to long. There are only a few minor differences between these two games, pretty poorly "jquery loading" and a few different features, but I'm just a n00b... CrimeCity 2014 TornCity 2004 /endrant
-
Built from scratch? This looks like a much bigger successful game I play called Torn City (Torn.com) Exact same icons, gameplay, links, layout, mechanics, etc... Am I missing something?
-
LESS TALK MORE CODING!!! Lol Jk, good luck
-
Agreed, was an afterthought. Was thinking of putting tabs there, but would prob look better without. Ill remove and do a few other tweaks and post again Here's the changes:
-
ahh, gotcha! I changed the headers to be more grungy to keep it consistent.
-
thats what I meant, layout! learning as I go here, lol. What do you mean you dislike the "theme".... the theme of the layout, or the idea of a nuke going off on the world as we know it? lol
-
just realized the bars are out of focus, opps
-
This is just a intro/splash page. Let me know what you think. Text obviously needs alot of work, but thats just a matter of tweaking. - - - Updated - - - Try 2:
-
Awesome idea!! That should atleast give me a starting point that I can tweak during alpha testing! - - - Updated - - - Definitely read this article and have already started using what it speaks about :)
-
Thanks Djkanna, great info. Categorization is what I've been thinking pretty much, otherwise trying to compare apples to oranges will be nearly impossible. Crazy how quickly something can get so complicated! Much respect to all the games I've played over the years, haha
-
Way to complicate things even more!! haha
-
Thanks! I think I've seen this guy before, lol
-
Thats exactly what I was wondering. My issue is there will be a ton of handguns available, and im not overly knowledgeable on which is better then which, so it will be alot more work on my plate to figure all of that out. Oh well, perks of the job.
-
So I'm working on compiling a list of items for a game I'm working on. (Weapons, armour, food, etc....) My question is, how realistic do you keep things? Do you use real world items/real world logic, or do you make stuff up as you go? For example, I'm working on a weapons list and am using actual weapon names. Do you actually make the weapons as powerful in real life or do you just kind of find your own way to balance items? (I'm talking about attack scores/damage delivered) Any thoughts or comments? I'd love to hear em!
-
Ive got a potential userbase, but no knowledge...
njfrlng replied to njfrlng's topic in Partnerships
guidance document removed for the time being, want to keep it a surprise :p -
Ive got a potential userbase, but no knowledge...
njfrlng replied to njfrlng's topic in Partnerships
and a link to a guidance document outlining my goals/ideas https://docs.google.com/document/d/1zWE_w0DFLOGj9aAjDFysUVvF_4WIZUrRKcGZcGjZfcI/edit?usp=sharing