I have two textboxes in HTML and I want to join them into the same field in sql.
Those two textboxes where I have my cursor are the zip code ($zip and $zip2): http://i.imgur.com/tYxNZrX.png and I and to put them together on the same place in my sql table:
I'm inserting the values like this:
$insere="INSERT INTO Perfil VALUES ('".$nome."','".$apelido."','".$dataNasc."','".$sex."','".$PLSHELPME."','".$morada."','".$username."')";
How can i do this ?
Is it $zip+$zip2
or what ?
As asked by Typoheads:
<?php
$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];
$nome=$_POST['nome'];
$apelido=$_POST['apelido'];
$dataNasc=$_POST['dataNasc'];
$sex=$_POST['sex'];
$zip=$_POST['zip'];
$zip2=$_POST['zip2'];
$morada=$_POST['morada'];
echo '<h2>Registado:</h2>';
echo 'Bemvindo '.$nome.' '.$apelido.' aka '.$username.'.';
$conexao=mysql_connect('localhost','root','');
if (!$conexao)
{
echo 'falha na ligação,<br>';
echo mysql_error();
}
mysql_select_db("alienstore",$conexao);
$insere="INSERT INTO Perfil VALUES ('".$nome."',
'".$apelido."',
'".$dataNasc."',
'".$sex."',
'".$zip . $zip2."',
'".$morada."',
'".$username."')";
$resultado=mysql_query($insere);
if($resultado==1)
{
echo "<br><b>Registado</b>";
}
else
"<br><b>Erro, não registado</b>";
mysql_close($conexao);
}
?>
Ok now I got a new problem... that has nothing to do with the previous one: it all goes well without errors, but it seems that it isn't inserting to the table the right way. I checked the database and there was no data that I inserted.. Does anyone know any usual problems or erros that people do so I can check it on my code/programs?