PHP - Php Amend
Ok. I've attatched a few files of how the pattern goes.
I think I was told you need two managermessages for the amend,. The amend at the moment, brings up the form but then in the add form if you type anything and submit, it just adds a new article. i'm guessing you need a seperate edit form. but how do you put the message into the text box so that when you edit it saves and displays the new message while storing the old one. I've attatched the add,delete and amend commands plus the add form. if anyone can come up with a solution i'd be really greatful. the add form is in views/add_form.php and iv made a duplicate of the file in the same folder called edit_form.php. Thanks Similar TutorialsMy database has a Product field which will change from holding a single product, to multiple products. How can i amend the product check in the attached code so it checks if the product is in the string? The product in the database appears as 1001, however in the new database it will appear with multiple products such as 1001,1002,1003,1004 Code: [Select] <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="pass"; // Mysql password $db_name="sales"; // Database name $tbl_name="orders"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $CustomerEmail=$_POST['CustomerEmail']; $IsPaid="-1"; $Product="1001"; // To protect MySQL injection (more detail about MySQL injection) $CustomerEmail = stripslashes($CustomerEmail); $IsPaid = stripslashes($IsPaid); $Product = stripslashes($Product); $CustomerEmail = mysql_real_escape_string($CustomerEmail); $IsPaid = mysql_real_escape_string($IsPaid); $Product = mysql_real_escape_string($Product); $sql="SELECT * FROM $tbl_name WHERE CustomerEmail='$CustomerEmail' and IsPaid='$IsPaid' and Product='$Product'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $CustomerEmail, table row must be 1 row Hi guys, Am having trouble with my OO php blog. i can add, delete and search for messages but cannot update them as i get the folowing eror message (see below) Quote Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 'FROM messages WHERE id = NULL' at line 1' Have checked that when i hover over the link i do get an id number and it is pointing to the correct cmd i.e. blogAmend. Any ideas as to where i am going wrong, files attatched for further info. Hello, I am a new user here and new in php coding also. I am a student and i have this task to create a simple website and I am stacked at the Amend and Delete data, so i could really use any help asap. I really need your help because i have to finish this now. I have this search.php that searches my users and displays the user-names and next to them an Amend and a Delete button the links are like this: echo "<a href=:\"amend.php?id=" . $a_row['username'] . "\">Amend user</a>"; echo "<span> </span>"; echo "<a href=:\"delete.php?id=" .$a_row['username'] . "\">Delete user</a>" what code should i have in amend.php to make this work? Thanks in advance Hi, I am writing several scripts and some are used to amend extra information to a text file. However, I added a hyperlink to the text file so that the user can go back to a page where they can add extra information. However, since I have done this every time I amend more text to the text file, the extra text appears below the hyperlink rather than above it, and I was wondering if there was a way around this. My amend code is as follows: Code: [Select] <html> <head> <title>Amend File</title> <link rel="stylesheet" type="text/css" a href="rcm/stylesheet.css"> </head> <?php if($_POST['append'] !=null) { $filename="C:/xampp/htdocs/rcm/denman2.txt"; $file=fopen($filename, "a"); $msg="<p>Updated Information: " .$_POST['append']. "</p><br>"; fputs ($file, $msg); fclose($file); } ?> <body> <h1>Do you want to append to a document?</h1> Enter Updated Information: <form action="amendfile2.php" method="post"> <input type="text" size="40" name="append"><br><br> <input type="submit" value="Add updated information to report"> </form> <form action="viewfile3.php" method="post"> <input type="submit" size="40" value="View Web Blog"> </form> <form action="loginform.php" method="post"> <input type="submit" value="Click here to go to the Log In Screen"> </form> </body></html> And my text file is as follows: Code: [Select] <h1>Accident Report</h1> <p>First Name: Andrew Last Name: Denman Age: 18 Complete Weeks Since Accident: 2<br> <a href="amendfile2.php">Amend to this file</a> Any help would be appreciated |