List:General Discussion« Previous MessageNext Message »
From:David Robley Date:July 4 2001 1:28am
Subject:Re: INSERT problem
View as plain text  
On Tue,  3 Jul 2001 23:01, Glyndower wrote:
> Hi all,
>
> I'm new to the whole PHP and MySql stuff and I hopeful that I can get a
> push in the right direction for what I'm sure is a very sinple problem.
>
> I have succesfully created a databse using telnet and added data to it
> also using telnet.
>
> I have also succesfully got the data to display on a page using PHP.
>
> My problem is adding data from the PHP page.
>
> My insert code is:
>
> $query = "INSERT INTO guests ";
>
> $query .= "(guest_id, guest_name, ";
>
> $query .= "guest_email, guest_time, guest_message) ";
>
> $query .= "values(0000,'$name','$email',NULL,'$message')";
>
> mysql_pconnect("localhost","blahblah","blahblah")
>
> or die("Unable to connect to SQL server");
>
> mysql_select_db("blah") or die("Unable to select database");
>
> mysql_query($query) or die("Insert Failed!");

Add here

if(mysql_errno) { echo 'Error: ' . mysql_error() . '<BR>'; }

and if there is an error returned by mysql it will be displayed.

>
> When I add data via the form, npthing seems to happen, it does not add
> the data to the databse, nor does it pop any errors.
>
>
>
> Any help would be appreciated...tia

-- 
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA  

   "Now I can chop down that tree," said Tom with a heavy accent.
Thread
INSERT problemGlyndower3 Jul
  • Re: INSERT problemWerner Stuerenburg3 Jul
  • Re: INSERT problemDavid Robley4 Jul
    • Page Refresh?Glyndower11 Jul
      • Re: Page Refresh?Werner Stuerenburg12 Jul
      • Re: Page Refresh?Pieter De Temmerman12 Jul
  • Re: INSERT problemJoe Taraba13 Jul