Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!


Sponsored Content

 

 
 

Photo
- - - - -

My Sql Insert Statement


  • Please log in to reply
1 reply to this topic

#1 heyman

heyman

    HR 3

  • Active Members
  • PipPipPip
  • 53 posts

Posted 23 December 2004 - 06:33 PM

I'm having an issue with MySql insert statement. I have a page called test.php, created to check my insert statement. Here is the code on it.

$fullname="Elliot Springer";
$dbh=mysql_connect($host,$un,$pw);
mysql_select_db($dbname, $dbh);
$sql = "INSERT INTO members (name) VALUES ('$fullname')";
mysql_query($sql);
mysql_close($dbh);

Now, when i access this page (test.php) from any other page, the insert statement doesn't insert into the database, if I refresh the page (test.php), then it executes and the insert statement works. The only other thing on the page is the connection variables which are correct, hense the execution second time around.

Does anyone know why this would not execute when coming from another page, but does on the refresh?

Please help.

Thanks

#2 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 23 December 2004 - 07:37 PM

Since it works when you reload the page it shouldn't be anything with the coding on that specific page per se.

Are some variables being passed to the test page when you're coming from another page perhaps?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users