Jump to content

Problemupdating database


affordit

Recommended Posts

Can someone see what I am missing here? I just get a blank page ??

<?php
session_start();
$id=$_POST['id'];
$client_name=$_POST['client_name'];
$psword=$_POST['psword'];
$company_name=$_POST['company_name'];
$project_id=$_POST['project_id'];
$start_date=$_POST['start_date'];
$project_duration=$_POST['project_duration'];
$finish_date=$_POST['finish_date'];
$temp_url=$_POST['temp_url'];

include("teao_1_dbinfo2.inc");
$dbh=mysql_connect ("localhost","$conn_name", "$password") or die('Cannot connect to the database because:'.mysql_error());
mysql_select_db ("newsletter") or die(mysql_error();

$query = "Select * from projects Where id = '$id'";
$result = mysql_query($query) or die(mysql_error()."<br /><br />".$query);
if (mysql_num_rows($result)<1)
{
echo "NO RECORD WITH THAT ID EXISTS.";
exit();
}
else
{
$rows = mysql_fetch_array($result,MYSQL_ASSOC);
$update = "UPDATE `projects` SET `client_name`= '$client_name',`psword`= '$psword', `project_id`= '$project_id', `start_date`= '$start_date', `project_duration`= '$project_duration', `finish_date`= '$finish_date', `temp_url`= '$temp_url' WHERE `id`= $rows['id']";
mysql_query($update) or die(mysql_error();
}
(header("location: http://mysite.com/1_projects/edit_projects_db.php"));
?>

 

Thanks for looking

Link to comment
https://forums.phpfreaks.com/topic/145663-problemupdating-database/
Share on other sites

debug by echoing... i generally follow binaary tree approach :)

 

echo in middle of php page.

 

if you see echo problem is in second half, else in first half...divide problematic hald into 2, and repeat...

 

ofcouse if you see points most likely to break, echo before that first :) happy debugging !

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.