on 8/27/01 11:32 PM, Pyran Firebrand at [EMAIL PROTECTED] wrote:
> $query = "INSERT INTO rants VALUES (1, '$date', '$type', '$title',
> '$text')";
> mysql_db_query($query, $db_link) or die ("<br>Problem!");
> }
You should probably be specifying the database before the $query. By the
way, use of the mysql_db_query function is now deprecated. You may wish to
try:
mysql_select_db($database_name,$db_link);
mysql_query($query,$db_link);
> When I try to execute this, it doesn't add anything into the database, and
> prints out "Problem!". I have absolutely no idea why. Can someone give me
> some direction here? I would be eternally grateful for it.
The first step would be to echo the query and take a look at exactly what
you're asking the mysql server to do.
$query = "INSERT INTO rants VALUES (1, '$date', '$type', '$title',
'$text')";
echo $query;
exit;
If the query looks OK, you should try it via the command line mysql client
program to see what errors are reported. The errors from the command line
are generally more descriptive than those from PHP.
Another thing to try is instead of dying with "Problem!", try exiting with
mysql_error and/or mysql_errno, that is:
echo mysql_errno() , ': ' , mysql_error() , '<BR>';
HTH.
Sincerely,
Paul Burney
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Paul Burney
Webmaster && Open Source Developer
UCLA -> GSE&IS -> ETU
(310) 825-8365
<[EMAIL PROTECTED]>
<http://www.gseis.ucla.edu/>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--
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]