What's the "LIMIT 0,30" for ?

Also, you should probably do this:

$insert_result = mysql_query($insert_query) or die(mysql_error());

Then you wouldn't need to wait for an answer ;-)


----- Original Message -----
From: "Ryan Shrout" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 18, 2001 11:39 PM
Subject: INSERT INTO Table problems


Okay, another question from the stumbling idiot: what's wrong with this
code:

$insert_query = "INSERT INTO news (NewsID, Title, Date, Author, Source,
Link, Information, Status) VALUES ('', 'asdf', '2001-03-19 00:33:47', '1',
'asdf', 'asdf', 'asdf', '2') LIMIT 0, 30";
$insert_result = mysql_query($insert_query);

Anything?

$insert_result is 0, which means it failed, and it DID fail because the
entry is not in the database.  What is weird, is that I copied and pasted
that line from phpMyAdmin, which DID work!!  I pulling my hair out!

My eventual question will also be: is this a legal statement? :
$insert_query = "INSERT INTO news (NewsID, Title, Date, Author, Source,
Link, Information, Status) VALUES ($NewsID, $Title, $Date, $Author, $Source,
$Link, $Information, $Status) LIMIT 0, 30";
$insert_result = mysql_query($insert_query);

I guess I was just wondering if I need the ' ' around the variables like
'$Title', etc.

But, most importantly is that first question: why would it execute correctly
in phpMyAdmin, and then when I copy and paste the SQL-query from the
"Modifications have been saved" line of phpMyAdmin into a PHP file, run it,
and it fail?

Thank you for your assistance.

Ryan Shrout
Production Manager
Athlonmb.com
http://www.athlonmb.com
[EMAIL PROTECTED]





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to