JS 和PHP 数据库操作在一个页面
<?
require ("config.php3");
?>
<?
if($submit)
{
//echo $action;
//if($action=='update')
if($id)
{
$query="update banner_place set adv_plc='$adv_plc',size='$size',description='$description' where id=$id";
$message="update banner place ";
}
else
{
$query="insert into banner_place (adv_plc,size,description) values ('$adv_plc','$size','$description')";
$message="added banner place " ;
}
$my_res = mysql_db_query($phpAds_db, $query) or mysql_die();
// Header("Location: banner.php3?pageid=$pageid&message=".urlencode($message));
// Header("Location: banner.php3");
echo "<script>window.location.href ='admin.php3?pageid=$pageid&message=$message'</script>";
exit();
}
?>
<?
相关文档:
HTML代码
<form action="" method="post">
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="1"/>
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="2"/>
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="3"/>
<input name="ID_D ......
1.
$query = $this->db->query('SELECT name, title, email from my_table');
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->email;
}
2.
foreach ($query->result_array() as $row)
{ ......
PHP中居然没有读取BMP格式图片的函数,还好高人已经写好一个,我没看代码,反正能正常使用.
imagecreatefrombmp -- 从 BMP 文件或 URL 新建一图像
function imagecreatefrombmp($file)
{
global $CurrentBit, $echoMode;
$f=fopen($file,"r");
$Header=fread($f,2);
if($Header=="BM" ......
如果只是一个数据库的话,我们一般习惯这样写:mysql_select_db("guestbook");
mysql_query('select * from users');
但是如果是连接多个mysql,有可能出现同名的数据库,或者数据库中出现同名的表,所以就必须用完整的形式了,如下代码:
<?php
$link1 = mysql_connect('localhost1','root','root');
mysql ......