что именно нужно? ?
пиши в асю 389862837 помогу
сейчас напишу.
Другие языки программирования и технологии
Нужна помощь в PHP програмировании с обращением к БД MySQL
< ? php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
// This could be supplied by a user, for example
$firstname = 'fred';
$lastname = 'fox';
// Formulate Query
// This is the best way to perform an SQL query
// For more examples, see mysql_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'",
mysql_real_escape_string($firstname),
mysql_real_escape_string($lastname));
// Perform Query
$result = mysql_query($query);
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['firstname'];
echo $row['lastname'];
echo $row['address'];
echo $row['age'];
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
mysql_close($link);
? >
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
// This could be supplied by a user, for example
$firstname = 'fred';
$lastname = 'fox';
// Formulate Query
// This is the best way to perform an SQL query
// For more examples, see mysql_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'",
mysql_real_escape_string($firstname),
mysql_real_escape_string($lastname));
// Perform Query
$result = mysql_query($query);
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['firstname'];
echo $row['lastname'];
echo $row['address'];
echo $row['age'];
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
mysql_close($link);
? >
mysql_query("DELETE FROM имя_таблицы WHERE имя_поле like 'запись");
mysql_query("UPDATE имя_табл SET имя_поле='новая_запись' WHERE имя_сл_поле= 'данные'");
mysql_query("UPDATE имя_табл SET имя_поле='новая_запись' WHERE имя_сл_поле= 'данные'");
Похожие вопросы
- нужна помощь в написани php кода для создания авторизации пользователя и регистрации
- БД MySQL Что лучше? В одно поле запихнуть похожую информацию или создать много полей?
- Какая концепция таблиц в БД MySQL лучше?
- Добрый день. Только начинаю осваивать с#. И вот возник вопрос. Как программно заполнить combobox из таблицы бд mysql?
- Не выходит получить страницу с помощью cUrl PHP .
- Php + html нужна помощь
- срочно нужна помощь по бд в delphi
- php програмирование
- С чего начать изучение? C, C++, Java, Python, PHP, Perl, Lisp, HTML5, CSS3, JavaScript, MySQL, Adobe Flash
- Нужна помощь по информатике.