
musnoure
Members-
Posts
41 -
Joined
-
Last visited
Never
Everything posted by musnoure
-
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!!
-
working now! Thanks for your help!
-
found missing comma, thanks for pointing that out!
-
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?
-
I changed it to that, no error messages but the fields won't change to the new value! What am I missing here!!
-
$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
-
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.
-
Let me try that, and I will get back to you.
-
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...
-
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.
-
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.
-
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!!!!
-
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
-
Fetch last records added from multiple tables; Mysql & PHP.
musnoure replied to musnoure's topic in PHP Coding Help
what if you have multiple tables? -
Fetch last records added from multiple tables; Mysql & PHP.
musnoure replied to musnoure's topic in PHP Coding Help
What I really want to achieve is getting the last row inserted from each table. -
Fetch last records added from multiple tables; Mysql & PHP.
musnoure replied to musnoure's topic in PHP Coding Help
Hi, thanks for the reply! I tried that but it did not work, ("SELECT * from `pets` LEFT JOIN `auto` ON `family`.`id`>0 DESC LIMIT 2"); --> error message: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in... -
...I have multiple categories; auto, family, business &finance... and I set up one table for each category in Mysql. I'd like to retrieve the last two records added. ("SELECT * from table_name ORDER BY id DESC LIMIT 3"); This works but only for one table. What if I added new articles in different tables, let's say I added one article in *family*one in *auto* and another in *pets*. Any help is appreciated, thank you!
-
IT WORKED!!! Thank you so very much, I really appreciate your help!!!!!! Is this your website? http://www.simonfranco.com/ Really cool looking!
-
oh sorry, it's proc that's a variable, not id, sorry! should I change it proc to id?
-
Yes (index.php?proc=1001) + the title of the page you helped me with eariler). So it lookds like this: index.php?proc=1001&title=Why%20my%20Check%20Engine%20Light%20is%20on
-
... [attachment deleted by admin]
-
Yes, let me send you a screenshot.
-
Ok, so far I have this: $id = $_GET['id']; $result = mysql_query("SELECT meta_keywords FROM auto WHERE `id` = '$id' LIMIT 1"); $row = mysql_fetch_assoc($result); echo $row['meta_keywords']; still not working, output is empty ):
-
I don't have that variable yet. something like this: $id = $_GET['id']; ??
-
I made those modifications, but the output is empty. <meta name="keywords" content=" " /> Here is the edited code: $result = mysql_query("SELECT meta_keywords FROM auto WHERE 'id' = '$id' LIMIT 1"); $row = mysql_fetch_assoc($result); echo $row['meta_keywords']; May I ask something, do I have to enclose id with single quotes? I actually tried it with and without but same output. I tried the following: WHERE id = id, and it did work but only for the first row. when you click on a different article, the keywords stay the same, do not change accordingly. So I have no idea what I am missing here. Thanks for the quick replies by the way!