HI,

I am new to this PHP thing.

I was working out of my PHP book and website and I noticed some
discrepancies in inputting data into the MySQL database.

I followed the example from my book and I noticed that the syntax for
putting data into a mysql database from PHP was like this:

$sql = "INSERT INTO news
VALUES (NULL,'$heading','$body','$date','$auth','$auth_email')";

However I read some information on the website and I noticed that they
added the field names right after the name of the table like this:

mysql_query ("INSERT INTO tablename (first_name, last_name) 
                VALUES ('$first_name', '$last_name')
             ");

I have two questions:

In the first example what is the meaning of putting the "NULL" before the
variables?

I was successful in entering data from my first example without declaring
field names, so why did they declare in field names in the second example?

If anyone can shed some light on this question, I would be most grateful.

Thanks.

Peter


-- 
PHP General 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