Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

id dissapears

0 views
Skip to first unread message

Joe Van Meer

unread,
May 9, 2003, 9:14:03 PM5/9/03
to
is the id value inserting properly into the database?

Cheers, Joe

"Kalvi" <in...@elektroonika.com> wrote in message
news:3ebb995e$1...@news.estpak.ee...
> Hi!
>
> I have a problem. The id is coming from a previous page. An print function
i
> s showing it. But when I want to insert data in the database with same id
th
> en the id is missing?
>
> Help
>
> <?php
> global $id;
> print "id=$id";
>
>
> if ($submit)
> {
> //please change the server name username and password according to your
my
> sql server setting
> $mysql_server="loaclhost";
> $mysql_username="username";
> $mysql_password="pass";
> $mysql_database="db";
> //connect to database using above settings
> @MYSQL_CONNECT("localhost",$mysql_username,$mysql_password);
> @mysql_select_db("db");
>
> $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
>
>
> $result=MYSQL_QUERY("INSERT INTO pesutoode_pilt
(id,bin_data,filename,file
> size,filetype) ".
> " VALUES
($id,'$data','$form_data_name','$form_data_size','$form_data_typ
> e')");
>
> print "<p>This file has the following Database ID: <b>$id</b>";
>
> MYSQL_CLOSE();
> }
> else
> {
> // else show the form to submit new data:
> ?>
>
>


Dave Darden

unread,
May 10, 2003, 12:40:26 AM5/10/03
to

If the id is coming from a previous page and shows on this one,
and assuming this page calls itself,
then you probably need to keep the id alive by creating a hidden variable in the
HTML form on the second half of the page.

<INPUT type=hidden name=id value="<? echo $id; ?>" >

Or something like that.


Kalvi

unread,
May 10, 2003, 10:54:36 PM5/10/03
to
Thanks!

Now it's working!

Kalvi

"Dave Darden" <qwa...@yahoo.com> wrote in message
news:b9hvdv$iu0kn$1...@ID-156870.news.dfncis.de...

0 new messages