NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP Form Question

Anthony Julien tony at jupub.com
Wed Oct 23 04:28:35 EDT 2002


Can anyone tell me what wrong with this code? I'm just trying to do an 
INSERT query in mySQL.

<?php

//trims received data from form above:

$artist = trim($artist);
$album = trim($album);
$label = trim($label);
$release = trim($release);
$description = trim($description);

// database connection variables:

$host = "localhost";
$user = "nubiannu_tony";
$password = "trini";
$dbname = "nubiannu_anthony";

$tablename = "NewTable";

$link = mysql_connect($host, $user, $password);

$query = "insert into $tablename values ('0', '$artist', '$album', 
'$label', '$release', '$genre', '$description')";

if ($submit){
if(mysql_db_query ($dbname, $query, $link)){
print("The query: $query was successful.\
");
}
else{
print("The query: $query was unsuccessful, please try again!");
}
mysql_close($link);
?>




-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1038 bytes
Desc: not available
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20021023/d8ab9b8a/attachment.bin>


More information about the talk mailing list