chibiwawa Posted June 2, 2013 Share Posted June 2, 2013 (edited) I am having trouble getting my edit page for my ecommerce site to work. You can log in here: http://lpehrson.mydevryportfolio.com/webdev/admin_login.php The user name is test@test.com and the password is test. The edit page is here: here: http://lpehrson.mydevryportfolio.com/webdev/edit.php As you can see there are a lot of errors. I can't find where I went wrong in the code. I have attached the files to this post. If you could help that would be great. I got the following response on another form: The errors are pretty straight forward. Your include paths are wrong which is why your getting those errors, and your database username is still using an @localhost, which wont work on a live site. You need to call the right include directory, probably /includes/file.php would do it. or ../includes, i dont know how you have the directories structured, but you can figure that part out. As for accessing the DB you'll need to get server username , password and probably the database name from your hosting provider, make those changes and you'll be on the right track. I changed the includes and it did not fix it. How would I sign into the database? I am very new to PHP. Please help! LPehrsoniLab4 (2).zip Edited June 2, 2013 by chibiwawa Quote Link to comment https://forums.phpfreaks.com/topic/278682-ecommerce-site-edit-page/ Share on other sites More sharing options...
chibiwawa Posted June 2, 2013 Author Share Posted June 2, 2013 I made the following changes: <?php if(isset($_POST['Submit_Update'])) { include('includes/dbc_admin.php'); $table = $_POST['products']; $id = $_POST['id']; $title = $_POST['title']; $description = $_POST['description']; mysql_query("UPDATE $table SET title = '$title', message = '$message' where id = '$id'") or trigger_error('Error: '.mysql_error(), E_USER_ERROR); $msg = "Your content has been successfully updated!<br />"; } ?> <?php if(isset($msg)) { echo $msg; } ?> <form method="post" action="<?php $_SERVER['PHP_SELF'];?>"> <?PHP // Get the ID and Table name into variables $id = $_GET['id']; $table = $_GET['table']; include('includes/dbc_admin.php'); $sql = "SELECT * FROM $table where id = $id"; $result = mysql_query($sql); while($row = mysqli_fetch_assoc($result)) { echo '<input type="hidden" name="id" value="'.$id.'">'; echo '<input type="hidden" name="table" value="'.$table.'">'; echo '<textarea name="message" width="500" height="300">'.$row['message'].'</textarea>'; } ?> <input type="submit" name="Submit_Update" value="Update"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/278682-ecommerce-site-edit-page/#findComment-1433661 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.