> I have succesfully created a databse using telnet and added data to it also
> using telnet.

Why not do it with myPhpAdmin? Google shows you the address. Very
convienient. It pays at least in the long run - you won't bother
with telnet to maintain your db.

> I have also succesfully got the data to display on a page using PHP.

Good.

> My problem is adding data from the PHP page.

> When I add data via the form, npthing seems to happen, it does not add the
> data to the databse, nor does it pop any errors.

I didn't bother to understand your code and look for an error
source. You could look for an error message of mysql.

Ypur code ahows that the query has been issued successfully,
hence no death. But the result of the query was not what you
expected, hence there must be an error.

Here is how I do it. Again, very convenient. You put out ten
times as many queries this way. Not only that you are much more
productive, it is much more fun this way, too.

Use db_mysql.inc from PHPLIB (again: Google shows where to get
it). Then write:

include_once db_mysql.inc;
//include library
$datum = date("Y-m-d");
//get date
$db = new DB_Sql;
//let the lib connect etc.
$q = "INSERT INTO 
        (guest_name, guest_email, guest_time, guest_message)
        VALUES ('$name','$email','$datum','$message')";
//do it all in once - so you see what you do.
//don't provide for id's - use an autoincrement field instead and
//let mysql provide for numbering.
//if you have a date field, provide for a date value. It is easy.
//if you have NULL values, omit them.
$db->query($q);
//let the lib do the stuff
if ($db->Error) echo $db->Error . '\n<br>';
//lib knows Error and shows it

I use an editor with shortcuts. I have shortcuts for all this
stuff, so I don't have to push the keys too often (RSI).

You could automate this further. Include the above error
statement into the query function in the library. If you work on
production systems, qualify this error message by the existence
of a cookie value which shows that you are testing. Hence other
users won't see anything, but you do automatically.

You can use the lib out of the box. Just provide for the
connection data, password etc. Make sure you put the location of
the lib outside your home dir or protect it with an .htaccess
file, as the password is in plain text in the local.inc file.


-- 
Herzlich
Werner Stuerenburg            

_________________________________________________
ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
Tel 0(049) 5224-997 407 · Fax 0(049) 5224-997 409
http://pferdezeitung.de


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to