...

Entering new row, using PHP

Jabbamonkey
08-15-2002, 10:34 PM
I'm trying to add a row to a MySQL database using PHP. I keep getting an error though.

Here is the line of code...

insert into advisoryarticles values ("", $article_date, $article_title, $article_url, $bioid, $article_source);

The first field is an auto_incremental field, so I am trying to leave it blank and let the database choose. Is that where the problem lies?


Jabbamonkey

mouse
08-15-2002, 10:54 PM
You don't need to leave that blank when auto_increment is specified...

Try this (I'm assuming you have the field names the same as the variable names, right?):

INSERT INTO advisoryarticles(article_date,article_title,article_url,bioid,article_source) VALUES('$article_date','$article_title','$article_url','$bioid','$article_source');

Dunno, why it's being truncated btw :confused:

Jabbamonkey
08-15-2002, 11:28 PM
Silly me. What I had would have worked....

I'm using a PHP book to learn this stuff, and the book overlooked a simple and important aspect...

PUT ALL THE ABOVE INTO A mysql_query...
mysql_query(" ",$db);

Ug...

Spookster
08-16-2002, 05:34 AM
Jabbamonkey,

If you are going to ask mysql related questions you need to post them in the mysql forum.

Jabbamonkey
08-16-2002, 08:08 AM
...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum