Pages: Previous123Next
Current Page: 2 of 3
Re: how to store values into database
Posted by: toivo (---.nsw.bigpond.net.au)
Date: May 29, 2008 11:22PM

Depending on how your HTML page is presented, you can have something like this on the form, ignoring the fact that you could have a checkbox for the allow option:

<table>
<tr>
<td>Allow members to view</td><input type="text" size="10" name="allow" value="$allow" /></td>
</tr>
<tr>
<td>E-Mail Address</td><td><input type="text" size="30" name="email_address" value="$email" /></td>
</td>
</table>

When you process the POST, you can just use the field names:

$allow = $_POST['allow'];
$email = $_POST['email_address'];

$sql="INSERT INTO mytable (allow_members, e_Mail) VALUES ('$allow','$email')";

Regards,

toivo
Sydney, Australia

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 29, 2008 11:26PM

or u can use anyting in ur html

<input type="text" size="10" name="name1" >


in the php


$name2 = $_POST['name1'];
$sql="INSERT INTO mytable (allow_members) VALUES ('$name2')";

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 08:28PM

$emails = $_POST['EMail'];
$username = $_POST['Name'];
$password = $_POST['Password'];
$firstname = $_POST['FirstName'];
$lastname = $_POST['LastName'];
$country = $_POST['Country'];
$receive = $_POST['ReceiveEMail'];


$sql=("INSERT INTO customer (E_Mail, Username, Password, Firstname, Lastname, Country, Allow_emails) VALUES ('$emails','$username','$password','$firstname','$lastname','$country','$receive')"winking smiley;


this is my new code i did accordingly but its showing me an error: Duplicate entry " for key 1.


can you please help me..

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 30, 2008 08:38PM

in phpmyadmin open up ur table.. ul see abox for the storage engine..
change it to MyISAM as you not using relaional dbs

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 08:51PM

i just opened phpmyadmin nd above reload privileges i saw a storage engine i changed in that but still i'm facing the same problem

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 30, 2008 08:53PM

u must have set up the table wrong....
can u export the table? and post up the exprted sql code

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 08:57PM

phpMyAdmin SQL Dump
-- version 2.11.6
-- [www.phpmyadmin.net]
--
-- Host: localhost
-- Generation Time: May 30, 2008 at 02:56 PM
-- Server version: 5.0.51
-- PHP Version: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `minhas`
--

-- --------------------------------------------------------

--
-- Table structure for table `customer`
--

CREATE TABLE `customer` (
`E_Mail` varchar(300) NOT NULL,
`Username` varchar(150) NOT NULL,
`Password` varchar(200) NOT NULL,
`Firstname` varchar(150) NOT NULL,
`Lastname` varchar(200) NOT NULL,
`Country` varchar(150) NOT NULL,
`Allow_emails` varchar(10) NOT NULL,
PRIMARY KEY (`Username`),
UNIQUE KEY `E_Mail` (`E_Mail`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `customer`
--

INSERT INTO `customer` (`E_Mail`, `Username`, `Password`, `Firstname`, `Lastname`, `Country`, `Allow_emails`) VALUES
('', '', '', '', '', '', '');

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 30, 2008 09:07PM

PRIMARY KEY (`Username`),
UNIQUE KEY `E_Mail` (`E_Mail`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1



u dont need uniquie here.... turn it off...


and swicth the engine to MyISAM

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 09:16PM

THANKS STEVEN .....I DID THAT BUT I'M STILL FACING THE SAME PROBLEM..

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 09:23PM

Table structure for table `customer`
--

CREATE TABLE `customer` (
`E_Mail` varchar(300) NOT NULL,
`Username` varchar(150) NOT NULL,
`Password` varchar(200) NOT NULL,
`Firstname` varchar(150) NOT NULL,
`Lastname` varchar(200) NOT NULL,
`Country` varchar(150) NOT NULL,
`Allow_emails` varchar(10) NOT NULL,
PRIMARY KEY (`Username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `customer`
--

INSERT INTO `customer` (`E_Mail`, `Username`, `Password`, `Firstname`, `Lastname`, `Country`, `Allow_emails`) VALUES
('', '', '', '', '', '', '');

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 30, 2008 09:45PM

its still innodb ,,,,

do u see this?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 09:47PM

i've even changed the storage engine and removed the unique key. but its still not working. please help me in this

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 30, 2008 09:53PM

u havented changes the engine for this table..
its still innob

it needs to be myisam

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 10:00PM

no i did. it but still facing the same problem
Table structure for table `customer`
--

CREATE TABLE `customer` (
`E_Mail` varchar(300) NOT NULL,
`Username` varchar(150) NOT NULL,
`Password` varchar(200) NOT NULL,
`Firstname` varchar(150) NOT NULL,
`Lastname` varchar(200) NOT NULL,
`Country` varchar(150) NOT NULL,
`Allow_emails` varchar(10) NOT NULL,
PRIMARY KEY (`Username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `customer`
--

INSERT INTO `customer` (`E_Mail`, `Username`, `Password`, `Firstname`, `Lastname`, `Country`, `Allow_emails`) VALUES
('', '', '', '', '', '', '');

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 30, 2008 10:05PM

drop your customer table by pressing drop along the top


then press sql will in the dababase

put this code in


CREATE TABLE `customer` (
`E_Mail` varchar(300) NOT NULL,
`Username` varchar(150) NOT NULL,
`Password` varchar(200) NOT NULL,
`Firstname` varchar(150) NOT NULL,
`Lastname` varchar(200) NOT NULL,
`Country` varchar(150) NOT NULL,
`Allow_emails` varchar(10) NOT NULL,
KEY `Username` (`Username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;



and press go

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 10:10PM

hey it worked thanks a lot...

Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 10:10PM

steven thanks a lot

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 30, 2008 10:11PM


Options: ReplyQuote
Re: how to store values into database
Posted by: nav2626 (---.dl.stevens-tech.edu)
Date: May 30, 2008 10:14PM

but table is not showing me the values i have added...can you please tell me how do we chek the or view the full table with the contents added

Options: ReplyQuote
Re: how to store values into database
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 30, 2008 10:22PM

have you already added information?

opps... i taut u were setting up.. shoudlnt have dropped the table.. lol sorry

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Pages: Previous123Next
Current Page: 2 of 3


Sorry, only registered users may post in this forum.