Jump to content

data being send to two diffrent rows


franknu

Recommended Posts

ok i want this data to be send to one row instead of two diffrent rows

the text is going to on row and the file is going to  a diffrent one please help

[code=php:0]

<?

$host = "localhost";
$username = "townsfin_localho";
$password = "abc123";
$database = "townsfin_contacts";

$db = mysql_connect($host, $username, $password);
mysql_select_db($database);



  // Business Owner

  $First_Name = addslashes($_POST['First_Name']);
  $Last_Name= addslashes($_POST['Last_Name']);
  $Owner_Address = addslashes($_POST['Owner_Address']);
  $State= addslashes($_POST['State']);
  $City= addslashes($_POST['City']);
  $Zip= addslashes($_POST['Zip']);
  $Tel= addslashes($_POST['Tel']);
  $Email= addslashes($_POST['Email']);
  $Position=addslashes($_POST['Position']);
  $Comments=addslashes($_POST['Comments']);


// Business Info

$BusinessName = addslashes ($_POST['BusinessName']);
$Slogan = addslashes($_POST['Slogan']);
$Business_Address = addslashes($_POST['Business_Address']);
$Tel = addslashes($_POST['Tel']);
$Website = addslashes($_POST['Website']);
$Email = addslashes($_POST['Email']);
$Member_Status = addslashes($_POST['Member_Status']);
$Fax =addslashes($_POST['Fax']);
$type = addslashes($_POST['type']);
$make = addslashes($_POST['make']);

// webpage info

$Categories = addslashes($_POST['Categories']);
$Keyword = addslashes ($_POST['Keyword']);
$Picture1 = addslashes (isset ($_POST['Picture1']));
$Headline = addslashes ($_POST['Headline']);
$Slogan2 = addslashes ($_POST['Slogan2']);
$Description1 = addslashes ($_POST['Description1']);
$Description2 = addslashes ($_POST['Description2']);
$Description3= addslashes ($_POST['Description3']);
$Contact2 = addslashes ($_POST['Contact2']);
$Picture2 = addslashes (isset($_POST['Picture2']));
$Picture3 = addslashes (isset($_POST['Picture3']));

$User_Name = addslashes ($_POST['User_Name']);
$Password = addslashes ($_POST['Password']);


if(!$db)

{
echo " Error: could not connect to database.";

exit;
  }


                 
    //Business Info

$sql="INSERT INTO `business_info`(`BusinessName`,`Slogan`,`Business_Address`,`Tel`,`Website`,`Email`,`Member_Status`,
`Fax`,`type`,`make`,`Categories`,`Keyword`,`picture1`,`Headline`,`Slogan2`,`Description1`,`Description2`,`Description3`,`Contact2`,
`Picture2`,`Picture3`,`User_Name`,`Password`)

Values('$BusinessName','$Slogan','$Business_Address','$Tel','$Website','$Email','$Member_Status','$Fax','$type','$make','$Categories','$Keyword',
'$Picture1','$Headline','$Slogan2','$Description1',
'$Description2','$Description3','$Contact2','$Picture2','$Picture3','$User_Name','$Password')";



$result = mysql_query($sql);
echo mysql_error();

if($result)

        {
echo mysql_affected_rows(). ".Business Information Inserted.";

        }


$uploaddir = '/home/townsfin/public_html/business_images/';
$uploadfile = $_FILES['Picture1']['name']; // No need for basename() here

if(!empty($_FILES['Picture1'])){
  var_dump($uploaddir);

  var_dump($_FILES['Picture1']['size']);
  var_dump($_FILES['Picture1']['error']);
  var_dump($_FILE);
  var_dump($_FILES['Picture1']['type']);
  var_dump($_FILES['Picture1']['name']);
}

$fullpath = $uploaddir . $uploadfile;
if (move_uploaded_file($_FILES['Picture1']['tmp_name'], $fullpath)){
  echo("File Uploaded");
  $sql = "INSERT INTO business_info (Picture1) VALUES ('$fullpath')";
  $result = mysql_query($sql);
  if (!$result){
      echo "Error inserting data: " . mysql_error();
  }
}
else {
  echo ("file no uploaded!");
  print_r($_FILES);
  echo realpath('./');
}
?>

[/code]
Link to comment
Share on other sites

the info that i am getting from my form is going to two diffrent rows. i want the data that is input by the user to be send in only one row on the database

i know that i have two insert statement in my code,

one for my database and another one for the path for the file that is being insert please help
Link to comment
Share on other sites

I don't guess you HAVE to, but if all those columns won't display across one screen, then that is likely your problem...and in my opinion deleting some columns from this display php code could solve it.  I don't think you should necessarily delete them from the database, perhaps just the table being displayed on the php page in question.

[quote author=franknu link=topic=119284.msg489609#msg489609 date=1166712271]
yes i have 24 colums?

so do i have to delete some colums
[/quote]
Link to comment
Share on other sites

if you choose say five columns to display on your php page, how does that look?

[quote author=franknu link=topic=119284.msg489634#msg489634 date=1166714255]
i made my database 22 colums and still the file is uploaded file is going to a diffrent row please help
[/quote]
Link to comment
Share on other sites

What I'm saying is this...if you send that much data to the browser, it seems to me that it must go on at least two lines because all of it won't print on one...or am I misunderstanding the issue?

[quote author=franknu link=topic=119284.msg489638#msg489638 date=1166714552]
ok i have a form where all the data is being submitted from all the text goes to one row but the file is going to  the next row, i think that my problem is on the insert code
[/quote]
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.