ok,
this is the script
PHP Code:
<?php
include "connection.php";
// Connect to server and select databse.
if (!$con)
{
die('Could not connect: ' . mysql_error() );
}
mysql_select_db($db, $con);
// username and password sent from signup form
$user=$_POST['username'];
$pass=$_POST['password'];
$sql="SELECT * FROM our_info WHERE username='$username' and password='$password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "failed.html"
session_register("user");
session_register("pass");
header("location:../main.php");
}
else {
header("location:../failed.html");
}
?>
that worked, however, on another script, it stopped working..
PHP Code:
<?PHP
//Get the data to update
$contact = $_POST['contact'];
$business = $_POST['business'];
$add1 = $_POST['add1'];
$add2 = $_POST['add2'];
$town = $_POST['town'];
$county = $_POST['county'];
$postcode = $_POST['postcode'];
$country = $_POST['country'];
$tel = $_POST['tel'];
$fax = $_POST['fax'];
$email = $_POST['email'];
$web = $_POST['web'];
$view = $_POST['view'];
// Make Connection
include 'connection.php';
if (!$con)
{
die('Could not connect: ' . mysql_error() );
}
mysql_select_db($db, $con);
//Run the update query
$sql = "UPDATE our_info SET contact = '$contact' , business = '$business' , add1 = '$add1' , add2 = '$add2' , town = '$town' , county = '$county' , postcode = '$postcode' , country = '$country' , tel = '$tel' , fax = '$fax' , email = '$email' , web = '$web' , view = '$view' WHERE username = '$user'";
mysql_query( $sql , $con ) or die( "<strong>Query Error</strong>: " . mysql_error() . "<br><strong>Query</strong>: $sql<br><br>" );
echo $user ;
//Close the connection
mysql_close($con);
?>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=../yourdetails.php">
the echo works fine but it doesnt update the database..?
any thoughts?
Bookmarks