Jump to content
  • 0

Не исполняется запрос


Alex&R
 Share

Question

Вот форма:

<form enctype="text/plain" method="post" action="admin/adm_clients_script.php">
<table height="100%" border="1" cellpadding="2" cellspacing="0">
<tr>
<td align="right">
Ім'я:
</td>
<td>
<input type="text" name="name" size="25">
</td>
<td align="right">
Фамілія:
</td>
<td>
<input type="text" name="sname" size="25">
</td>
</tr>
<tr>
<td align="right">
День народження:
</td>
<td>
<input type="text" name="dbirth" size="8" onkeypress="return testKey(event)">
</td>
<td align="right">
Email:
</td>
<td>
<input type="text" name="email" size="25">
</td>
</tr>
<tr>
<td align="right">
Логін:
</td>
<td>
<input type="text" name="login" size="25">
</td>
<td></td>
<td></td>
</tr>
<tr>
<td align="right">
Пароль:
</td>
<td>
<input type="pass" name="password" size="25">
</td>
</tr>
<tr>
<td colspan="4">
<button type="submit">Відправити форму</button>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>

А вот скрипт который делает запрос:

<?php
$conn=mysql_connect("localhost", "Admin", "123");
mysql_select_db("mydatabase", $conn);
$sql = "INSERT INTO mydatabase.clients (name, sname, dbirth, e-mail, login, password)
VALUES ( ".$_REQUEST['name'].", ".$_REQUEST['sname'].", ".$_REQUEST['dbirth'].", ".$_REQUEST['e-mail'].", ".$_REQUEST['login'].", ".$_REQUEST['password'].")";
?>

Но запись все ровно в таблицу не добавляется. Что не так ?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
name - экранировать все названия ячейк.

VALUES проставить кавычки.

Так:

<?php
$conn=mysql_connect("localhost", "Admin", "remoteroot");
mysql_select_db("freeplace", $conn);
$sql = "INSERT INTO freeplace.clients ('name', 'sname', 'dbirth', 'e-mail', 'login', 'password')
VALUES ( ".$_REQUEST['name'].", ".$_REQUEST['sname'].", ".$_REQUEST['dbirth'].", ".$_REQUEST['e-mail'].", ".$_REQUEST['login'].", ".$_REQUEST['password'].")";
?>

или нет?

Edited by Alex&R
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

×
×
  • 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. See more about our Guidelines and Privacy Policy