I am new to sql/php but having a problem getting data into a
mysql database and then being able to query it.
This is the portion to insert, from the php script:
// INSERT DATA
mysql_connect($host,$user,$password);
if ($REQUEST_METHOD=="POST") {
@mysql_select_db("$db") or die("Unable to open database");
$query = "INSERT INTO phpostcards (id, pic, sound, pbcolor, hbcolor, htcolor, hfont, htext, mbcolor, mtcolor, mfont, message, sname, smail, rname, rmail, senddate, pickup_id, date) VALUES ('','$pic','$sound','$pbcolor','$hbcolor','$htcolor','$hfont','$htext2','$mbcolor','$mtcolor','$mfont','$message2','$sname2','$smail2','$rname2','$rmail2','$senddate','$unique', now())";
$result = mysql_db_query("$query");
if (!$result) { echo("ERROR: " . mysql_error() .
"\n$query\n"); }
echo ("New Link Added\n");
}
When I run this, I get the error message:
Wrong parameter count for mysql_db_query()
Reading these forums, I found a similar problem so I changed the
mysql_db_query to:
$result = mysql_db_query("db","$query");
When I run this, I get the following error:
ERROR: Table 'db20738a.phpostcards' doesn't exist
INSERT INTO phpostcards (id, pic, sound, pbcolor, hbcolor, htcolor, hfont, htext, mbcolor, mtcolor, mfont, message, sname, smail, rname, rmail, senddate, pickup_id, date) VALUES ('','xmas.gif','','FFFFFF','000080','FFFFFF','Comic Sans MS','zxcvzxcvzxcv','FFFFFF','000000','Arial','zxcvxzcvxzcvzcv','asdf','will@bill.com','sdh','bob@bob.com','2001-09-15','9a3c5242ab6b5be42f3c', now())
I thought I was having trouble with the now() portion, so I changed this
to :
$todaysdate = date("Y-m-d"); and the VALUE to '$todaysdate', but,
while it did return todays date, it didnt seem to help the script run.
If anyone can give me a pointer I would appreciate it. This was a free
script but there is no support of course, and I am trying to fix it myself.