Ask a Question related to PHP Development, Design and Development.
-
Stephen Tiano #1
Newbie Having Trouble with Tutorial Book
I found a new book for starting out to learn PHP/MySQL Web App
programming. I've begun exercises toward that end.
So far I've opened MySQL--I'm on a Macintosh PowerBook, so that's
UNIX--as root and created a database I called guest_recorder. Then I
GRANTed ALL to a new user (me) with a password. I then quit MySQL.
Next I opened MySQL again as the new user I created, did a USE
guest_recorder and then created my first table guest_info. The table
had five columns: name, location, email, url, and comments. When I did
a DESCRIBE guest_info, it properly displayed the columns.
Then I typed "dbconnect.php":
<?php
mysql_connect("localhost", "--------", "-------") or
die ("Could not connect to database");
mysql_select_db("guest_recorder") or
die ("Could not select database");
?>
followed by "create_entry.php":
<html>
<head>
<title>Create Entry</title>
</head>
<body>
<?php
include("dbconnect.php");
if ($submit == "Sign!")
{
$query = "insert into guest_info
(name,location,email,url,comments) values
<'$name', '$location', '$email', '$url', '$comments')"
;
mysql_query($query) or die (mysql_error());
?>
<h2>Thanks!</h2>
<h2><a href="view.php">View My Guest Book!</a></h2>
<?php
}
else
{
include("sign.php");
}
?>
and "sign.php":
When I open "create_entry.php" in my browser, the form and its five
fields appear correctly, and I fill them out. I then hit the "Sign,
dammit!" button.
I was expecting the "Thanks!" and "View My Guest Book!" messages, but
instead am greeted with the same form with its five blank fields so's I
can type in info for name, location, email, url, and comments.
When I go to view the table named "guest_info" in the database named
"guest_recorder" using SELECT * FROM guest_info, I'm told "Empty set".
If the form's info isn't making it to the table, I'm thinking I need
$_POST statements--as in $_POST["name"], $_POST["location"],
etc.--somewhere to get each field's info into the table. But where do I
put those lines and in which file: "create_entry.php" or "sign.php"?
Thank you.
Stephen Tiano Guest
-
Aftermarket book or tutorial.
I am a student using the PhotoShop CS package. As the Photo Editor of the college newspaper, I am trying to converge a print story, a few still... -
apache axis book/tutorial
Hi, what book or tutorial on the web would you recommend for learning about apache axis? Thanks! Diego -
cell renderer book/tutorial ?
Does anyone know of a tutorial or book that covers the cell renderer in any depth? I've been trying to make a multiline cell renderer based on the... -
Looking for a good trigonometery tutorial or book?
Jeez, if my old schoolteacher could hear me saying that! Actually volunteering for trig. Mine is rusty, but Flash is heaps more fun with a bit of... -
Looking for tutorial/book
Hello everyone, I have zero experience with flash and I'm looking for a tutorial that would address the following scenario: a demo for a windows...



Reply With Quote

