well, your trying to get the insert_id() without running the query first. so
you have to add:
mysql_query($query);
before:
$art_id = mysql_insert_id();
also, your foreach loop should be:
foreach ($media_types as $type)
(without the brackets [])
i am assuming $media_types is an array already.
Hello jack,
Friday, June 10, 2005, 3:11:17 AM, you wrote:
jj> All the first part of the query works and inserts records into the
jj> database, and it's when I try to get mysql_insert_id () that I seem to
jj> run into trouble. Ah. ave I not yet run the first query? The part of
jj> the code that ac
Whoops. I must be botching this syntax because this is printing
",,0,," as the query:
All the first part of the query works and inserts records into the
database, and it's when I try to get mysql_insert_id () that I seem to
run into trouble. Ah. ave I not yet run the first query? The part of
th
Thank you Sebastian! Saved me some hell there!!
On 6/9/05, Sebastian <[EMAIL PROTECTED]> wrote:
> Don't forget to mention that even if you don't select a checkbox it will
> still add a empty record to the db.. i know for sure the foreach loop
> will add a record even if a box is not check, so you
Don't forget to mention that even if you don't select a checkbox it will
still add a empty record to the db.. i know for sure the foreach loop
will add a record even if a box is not check, so you have to check its
actually set before you start inserting.
Richard Davey wrote:
Hello jack,
Fri
Hello jack,
Friday, June 10, 2005, 2:16:06 AM, you wrote:
jj> $query = "INSERT INTO media_art (media_art_id,art_id, media_id)
jj> VALUES ('','" . $art_id . "','" . $media_types[2]. "')";
jj> repeat as many or few times as possible to account for the number of
jj> checked boxes, such
HI I have a form which pulls values from the db, and thanks to help
from the irc chat, hopefully makes any checkboxes which are selected
part of an array to be gotten in post:
while ($media_rows = mysql_fetch_assoc($media_result)){
$checkbox_media[] = "{$media_ro
7 matches
Mail list logo