Jump to content

musnoure

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

musnoure's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I have a question concerning building the Admin area. Let's say there are 3 pages. Page 1: "staff.php" (login/register page) Page 2: "staffproc.php" (process forms) Page 3: "adminManage.php" (Manage the content, edit, delete, add, etc.) I need to link the login page to the admin page so no one can access "adminManage.php" without providing the Login details. How??? Will I just include the login page into the admin? Any response will be appreciated!!
  2. working now! Thanks for your help!
  3. found missing comma, thanks for pointing that out!
  4. If you looked at the code that I edited, I had already given a name to the submit button. The id was passed, I tried both GET and POST! I do not now what did you mean by "those" problems. Which comma missed? Are you talking about the first pr the second query?
  5. I changed it to that, no error messages but the fields won't change to the new value! What am I missing here!!
  6. $results = mysql_query("SELECT * FROM crud WHERE id=".$_GET['id']."") or die (mysql_error()); $row = mysql_fetch_assoc($results); echo "<form action=\"\" method='POST'>"; echo "Database ID: <input type=\"text\" value=".$row['id']." name=\"id\" /> <br />"; echo "Year: <input type=\"text\" value=".$row['car_year']." name=\"car_year\" /> <br />"; echo "Make: <input type=\"text\" value=".$row['car_make']." name=\"car_make\" /> <br />"; echo "Model: <input type=\"text\" value=".$row['car_model']." name=\"car_model\" /><br /><br />"; echo "Description:<br /><textarea rows=\"15\" cols=\"60\" name=\"description\" />". $row['description']. "</textarea>"; echo "<br /><input type=\"submit\" value=\"save\" name=\"save\">"; echo "</form>"; if(isset($_POST['save'])) { $id = $_POST['id']; $car_year = $_POST['car_year']; $car_make = $_POST['car_make']; $car_model = $_POST['car_model']; $description = $_POST['description']; // Update data $update = mysql_query("UPDATE crud SET car_year='$car_year', car_make='$car_make' car_model='$car_model', description='$description' WHERE id=".$_GET['id']."") or die (mysql_error()); echo 'Update successfull'; } ?> I got this error when I changed Malibu to Impala: 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 'car_model='Impala', description='The Chevrolet Malibu was introduced in 1997 and' at line 1
  7. I tried that, still not working. I have a question, what's supposed to go here (where question marks are) echo "<form action=\"???????\" method='POST'>"; I've tried echo "<form action=\"$_SERVER['PHP_SELF']\" method='POST'>"; but it is not working either.
  8. Let me try that, and I will get back to you.
  9. Yes, I did echo "<input type=\"text\" value=".$row['id']." name=\"id\" /> <br />"; By the way, I've changed "text" to "hidden", still, not changing...
  10. That's not the official form, I just need to know how is it going to work and then I will improve the query, security, etc.
  11. Sorry about that! What it does is, let's say the following is displayed in an input box: "Chevy". When I change it to, for example "Chevrolet" and hit the save button, it returns to "Chevy". Let me know if you need more info, and thanks for the replies! P.S. I've already tried POST instead of get, not working.
  12. Hello folks, I can not seem to find out why this code is not being executed properly. Basically, I'd like to edit Records, so I am using forms to retrieve data, make modifications then save them. <?php //connection to db $results = mysql_query("SELECT * FROM crud WHERE id=".$_GET[id]."") or die (mysql_error()); $row = mysql_fetch_assoc($results); echo "<form action=\"\" method=\"POST\">"; echo "Year: <input type=\"text\" value=".$row['car_year']." name=\"car_year\" /> <br />"; echo "Make: <input type=\"text\" value=".$row['car_make']." name=\"car_make\" /> <br />"; echo "Model: <input type=\"text\" value=".$row['car_model']." name=\"car_model\" /><br /><br />"; echo "Description:<br /><textarea rows=\"15\" cols=\"60\" name=\"description\" />". $row['description']. "</textarea>"; echo "<br /><input type=\"submit\" value=\"save\">"; echo "</form>"; if ($_POST['save']) { $car_year = $_POST['car_year']; $car_make = $_POST['car_make']; $car_model = $_POST['car_model']; $description = $_POST['description']; // Update data $update = mysql_query("UPDATE crud SET car_year='$car_year', car_make='$car_make' car_model='$car_model', description='$description' WHERE id=".$_GET['id']."") or die (mysql_error()); echo 'Update successfull'; } ?> Please HELP!!!!
  13. Hello, I am not new to PHP/MySQL but I do need some advice with the following. The website will have Categories (Main Category) and Sub-Categories. For instance, Authors --> List of Authors --> Authors' Book Lists --> Book Details. So I will need 2 to three sub-categories. I will need to create relational Database, but what is the best Database structure to start with? I know this is a very broad question but any ideas so I can get started would be very much appreciated! - Noureddine
  14. what if you have multiple tables?
  15. What I really want to achieve is getting the last row inserted from each 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.