If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Data wont save

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-11-06, 10:40
JD| JD| is offline
Registered User
 
Join Date: Dec 2003
Posts: 37
Data wont save

Hi,

I started designing a website with php which stores data in mysql database with a web hosting company on a trial package.

I wrote several scripts and all was working fine. Now I have an proper account with them and none of the "Insert" scripts work. I have checked re checked etc till i'm blue in the face. The only difference I can see is the new one has Collation "latin1_swedish_ci".

The php form returns no errors it just refreshes the page.

Any help gratefully received!

JD
Reply With Quote
  #2 (permalink)  
Old 07-12-06, 12:27
dbmab dbmab is offline
Registered User
 
Join Date: Apr 2006
Location: Denver, Co. USA
Posts: 240
This sounds like a permissions problem, but could you post your code or at least the lines of your code with the Insert query string and the query. Are you able to create tables? You might try deleting and recreating the user/password for the database.
Reply With Quote
  #3 (permalink)  
Old 07-13-06, 17:45
JD| JD| is offline
Registered User
 
Join Date: Dec 2003
Posts: 37
Hi I made a new script to test incase it was something with php_self the code below inserts a line into the dabase but all fields are blank except hcap which has the null value 0 inserted so the permissions should be ok .

Thanks
JD

Code:
<?

	$form ="<form action=\"insert.php\" ";
	$form.= "method =\"get\">";
	$form.= "Forename      :<input type=\"text\" name=\"Forename\" value=\"$Forename\" ><br>";
        $form.= "Surname       :<input type=\"text\" name=\"Surname\" value=\"$Surname\" ><br>";
	$form.= "Address Line 1:<input type=\"text\" name=\"Addy_Line1\" value=\"$Addy_Line1\" ><br>";
	$form.= "Address Line 2:<input type=\"text\" name=\"Addy_Line2\" value=\"$Addy_Line2\" ><br>";
	$form.= "Address Line 3:<input type=\"text\" name=\"Addy_Line3\" value=\"$Addy_Line3\" ><br>";
	$form.= "Postcode      :<input type=\"text\" name=\"Postcode\" value=\"$Postcode\" ><br>";
	$form.= "Phone         :<input type=\"text\" name=\"Phone\" value=\"$Phone\" ><br>";
        $form.= "Handicap      :<input type=\"text\" name=\"Hcap\" value=\"$Hcap\" ><br>";
	$form.= "<input type=\"submit\" value=\"Submit\">";
	$form.= "</form>";
	echo($form);
 ?>
and the the script it is passed to

Code:
<?

	$conn= @mysql_connect ("localhost",*******,"*******")
	or die ("Error connecting to database. Please try again or contact admin");
	
	$db =@mysql_select_db ("jd77_golf",$conn)
	or die ("Error accessing database");

	$sql = "insert into Member 
	(Forename,Surname,Addy_Line1,Addy_Line2,Addy_Line3,Postcode,Phone,Hcap)values 
        (\"$Forename\",\"$Surname\",\"$Addy_Line1\",\"$Addy_Line2\",\"$Addy_Line3\",\"$Postcode\",\"$Phone\",\"$Hcap\")";

	
	 $result = @mysql_query($sql,$conn)
	 
	or die("Error inserting data into database please contact admin");
	
	if($result) { echo("Member now added to the database") ; }
?>
Reply With Quote
  #4 (permalink)  
Old 07-13-06, 18:23
dbmab dbmab is offline
Registered User
 
Join Date: Apr 2006
Location: Denver, Co. USA
Posts: 240
This looks like it is a problem with register_globals. In your original script it appears that it is on (the $_GET[....] variables from the form automatically produce the variables by each name), but these variables are empty now, which would indicate that register_globals are off.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On