Jump to content

[SOLVED] Not Updating


Clinton

Recommended Posts

Not Updating... Not sure why...

 

<?
$id = $_GET["id"];

$facpr = $_GET["facpr"];
?>

<?php
$username = "*****";
$password = "*****";
$hostname = "localhost";

$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to Server<br>";

$selected = mysql_select_db("*****",$dbhandle)
or die("Can not open SLC Database");
echo "Connected to Salt Lake City Database<p>";

mysql_query("UPDATE training SET firstaidcpr = '$facpr' WHERE id='$id'");

echo "Database has been updated. You will be returned to the training page momentarily. <meta http-equiv='refresh' content='3;URL=training.php' >"

?>

<html>
<head>
<title>Database is Updating...</title>
</head>


<body bgcolor="#FFFFFF">

</body>


</html>

Link to comment
Share on other sites

change

$selected = mysql_select_db("*****",$dbhandle)
or die("Can not open SLC Database");
echo "Connected to Salt Lake City Database<p>";

to:

mysql_select_db("*****",$dbhandle)
or die("Can not open SLC Database");
echo "Connected to Salt Lake City Database<p>";

 

Link to comment
Share on other sites

Didn't do the trick.

 


$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to Server<br>";

mysql_select_db("clintona_SLC",$dbhandle)
or die("Can not open SLC Database");
echo "Connected to Salt Lake City Database<p>";

mysql_query("UPDATE training SET firstaidcpr = $facpr WHERE id=$id");

echo "Database has been updated. You will be returned to the training page momentarily. <meta http-equiv='refresh' content='3;URL=training.php' >"

?>

<html>
<head>
<title>Database is Updating...</title>
</head>


<body bgcolor="#FFFFFF">

</body>


</html>

Link to comment
Share on other sites

<html>
<head>
<title>Database is Updating...</title>
</head>
<?php
$id = $_GET["id"];

$facpr = $_GET["facpr"];
?>
<body bgcolor="#FFFFFF">
<?php
$username = "root";
$password = "*****"; //gotta love the fact I left the real password in there. glad it's just a test box. gotta change it now.
$hostname = "localhost";
$dbhandle = mysql_connect($hostname, $username, $password);
echo "Connected to Server<br>";
mysql_select_db("testing",$dbhandle);
echo "Connected to Salt Lake City Database<p>";

mysql_query("UPDATE training SET firstaidcpr = '$facpr' WHERE id='$id'");

echo "Database has been updated. You will be returned to the training page momentarily. <meta http-equiv='refresh' content='3;URL=training.php' >"

?>
</body>
</html>

works great for me. I had it updating a test user just fine for me.

Link to comment
Share on other sites

Wow thanks. That will help out I'm sure. Question about that... when I do that I get the result

 

2007- 04-12

 

There is a space between the - and the 04 and my DB is still not updating. Anyway to get rid of that space? I was just trying to mess with the code but can's seem to figure it out.

Link to comment
Share on other sites

Not sure why you'd be getting a space in there. But if you do, you can do this:

 

$myDate = "4/4/2008";

list($smonth, $sday, $syear) = split('[/.-]', $myDate);

$myDate = "$syear-$smonth-$sday";

$myDate = str_replace(" ", "", $myDate);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.