Using simple test scripts, I'm connecting to a MySQL DB through PHP after
inputting info into a form and hitting submit. Something is putting three
records instead of one into the mySQL DB.

For instance:
the two variables are: $event_title and $event_desc. These are gotten from
the form submitting to the PHP doc. The PHP code is as follows:

<?php

$link = mysql_connect("localhost", "llupien", "dod2196");
if (! $link)
 die ("Couldn't connect to MySQL");
mysql_select_db("scco") or die ("Couldn't open database phptest");
$query = "INSERT INTO events (title,description) values
('$event_title','$event_desc')";
mysql_query($query, $link) or die ("Couldn't add data to table:
".mysql_error());
mysql_close($link);

?>


It's simple and I know the syntax is right...but in my simple little table,
I get three records - one correctly entered and two blanks. The two blanks
force the autonumber ID field to increment, but are completely blank
otherwise. Why would I get three records?

I use MySQL and PHP with my hosting service...they have PHPMyAdmin
installed...when you add a record from PHPMyAdmin, it works peachy. So
something PHP is working just fine, just not *my* scripts.

One of my theories is that it's something about the way I
connect..."localhost" may be wrong or need a port?? I've asked them over and
over what the connection requires but they don't seem to know what they're
talkign about. They keep telling me the pathway "usr/local/mysql" etc, but
can't tell me how to connect to the mySQL db's.

Anyway, it might be hopeless, but I'm hoping someone can lead me in the
right direction. Thanks!
Lynne



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to