求网页高手做一个简单的查询的页面php+MySQL_百度知道
求网页高手做一个简单的查询的页面php+MySQL
输入mac地址就可以查到对应的ip地址,把ip和mac地址做一个数据库,所以希望做一个查询系统,做好了我可以再加!分不是问题。希望哪位高手帮下忙,做一个查询页面,一重做系统就有人就不知道ip了我们学校ip和mac地址绑定了了
提问者采纳
'form1& }
} , 'localhost'.it596.html" target="_blank">), `ip` CHAR( 30 ) NOT NULL ://>.com/html/10/category-catid-10; && <:';network'];>.'text& method=&搜索结果;){ echo 'ip'.2'.查询页面; id=".it596:///!=', `mac` CHAR( 30 ) NOT NULL ;;) { $res=mysql_query(&':
<a href=";, 1);mac&submit", FULLTEXT ( `mac`
) ) ENGINE = MYISAM
2; PHP学习的天地; <.插入数据?trim($_POST['?&button&]);;input type="?php $conn=mysql_connect(' name=& value="; 3;mac".&SELECT * FROM `mac_ip_list` WHERE `mac`='!': INSERT INTO `network`; /.创建数据库 CREATE DATABASE `network` DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_没有该 name=& }else{ echo '];'form id=", `mac`) VALUES ( '' $mac=isset($_POST[']); mysql_select_db(' name=&ip';mac'post".`mac_ip_list` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ;192.1;".$rs[';; action=&mac', '提交&button":' if($rs[' 对应的IP.$mac, $conn), 'ff-33-21-f4-44-f9'.168:'form1".`mac_ip_list` (`ip`;& $rs=mysql_fetch_array($res);); /.$'&input type=& id="!=' mac的格式自定义有‘-’还是没有‘-’; if ($ &;;root'form>: & CREATE TABLE `/html/10/category-catid-10
其他类似问题
为您推荐:
mysql的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁2251人阅读
可供学习的站点:一个简单的博客实现
上文是一个译文,其中的源代码在laravel4.2中已经无法使用,API函数有了一定的修改,请参考译文的原版blog
Laravel是一个典型的MVC架构(MODEL, VIEW, CONTROLLER),代码非常漂亮简介。
笔者根据相应的学习资料,打算自己写一个类似的博客,但实现的功能略有不同。
该项目计划完成的功能(暂定):
实现基本的用户的注册、登陆、邮箱验证功能。
每个用户可以发表以图片为内容的主题,可以描述题目和内容。
每个主题可以被任意多个用户评论。
管理员可以对用户、主题、评论进行操作和维护。
第一步(安装):
1、安装Laravel 4。具体步骤及命令参考
第二部(配置):
1.笔者使用的php环境是XAMPP,用mysql先建一个名为piclist的database,直接在XAMPP Control Panel点击MySQL的admin选项即可手动配置数据库相关的事项。
2.进入网站根目录,进入app/config。
#app.php修改如key,dubug选项,时区等配置
return array(
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
'debug' =& true,
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
'url' =& 'http://localhost/',
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
'timezone' =& 'Asia/Shanghai',
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
'locale' =& 'en',
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
'fallback_locale' =& 'en',
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
'key' =& 'Ov!WhEvJUCcoN!f3K6pQE7FzZJ$yDA#s',
'cipher' =& MCRYPT_RIJNDAEL_128,
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
'providers' =& array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Log\LogServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Database\MigrationServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Remote\RemoteServiceProvider',
'Illuminate\Auth\Reminders\ReminderServiceProvider',
'Illuminate\Database\SeedServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
'manifest' =& storage_path().'/meta',
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are &lazy& loaded so they don't hinder performance.
'aliases' =& array(
'App'
=& 'Illuminate\Support\Facades\App',
'Artisan'
=& 'Illuminate\Support\Facades\Artisan',
'Auth'
=& 'Illuminate\Support\Facades\Auth',
'Blade'
=& 'Illuminate\Support\Facades\Blade',
'Cache'
=& 'Illuminate\Support\Facades\Cache',
'ClassLoader'
=& 'Illuminate\Support\ClassLoader',
'Config'
=& 'Illuminate\Support\Facades\Config',
'Controller'
=& 'Illuminate\Routing\Controller',
'Cookie'
=& 'Illuminate\Support\Facades\Cookie',
'Crypt'
=& 'Illuminate\Support\Facades\Crypt',
'DB'
=& 'Illuminate\Support\Facades\DB',
'Eloquent'
=& 'Illuminate\Database\Eloquent\Model',
'Event'
=& 'Illuminate\Support\Facades\Event',
'File'
=& 'Illuminate\Support\Facades\File',
'Form'
=& 'Illuminate\Support\Facades\Form',
'Hash'
=& 'Illuminate\Support\Facades\Hash',
'HTML'
=& 'Illuminate\Support\Facades\HTML',
'Input'
=& 'Illuminate\Support\Facades\Input',
'Lang'
=& 'Illuminate\Support\Facades\Lang',
'Log'
=& 'Illuminate\Support\Facades\Log',
'Mail'
=& 'Illuminate\Support\Facades\Mail',
'Paginator'
=& 'Illuminate\Support\Facades\Paginator',
'Password'
=& 'Illuminate\Support\Facades\Password',
'Queue'
=& 'Illuminate\Support\Facades\Queue',
'Redirect'
=& 'Illuminate\Support\Facades\Redirect',
'Redis'
=& 'Illuminate\Support\Facades\Redis',
'Request'
=& 'Illuminate\Support\Facades\Request',
'Response'
=& 'Illuminate\Support\Facades\Response',
'Route'
=& 'Illuminate\Support\Facades\Route',
'Schema'
=& 'Illuminate\Support\Facades\Schema',
'Seeder'
=& 'Illuminate\Database\Seeder',
'Session'
=& 'Illuminate\Support\Facades\Session',
'SoftDeletingTrait' =& 'Illuminate\Database\Eloquent\SoftDeletingTrait',
'SSH'
=& 'Illuminate\Support\Facades\SSH',
'Str'
=& 'Illuminate\Support\Str',
'URL'
=& 'Illuminate\Support\Facades\URL',
'Validator'
=& 'Illuminate\Support\Facades\Validator',
'View'
=& 'Illuminate\Support\Facades\View',
#database.php这里修改默认的数据库连接以及连接属性。这里选用mysql,以及默认的数据库是我们刚刚手动新建的piclist,用户名密码为自己mysql的配置,笔者的mysql仅为测试用,所以为无密码的root账户。
return array(
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
| By default, database results will be returned as instances of the PHP
| stdC however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
'fetch' =& PDO::FETCH_CLASS,
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
'default' =& 'mysql',
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
'connections' =& array(
'sqlite' =& array(
'driver'
=& 'sqlite',
'database' =& __DIR__.'/../database/production.sqlite',
'prefix'
=& '',
'mysql' =& array(
'driver'
=& 'mysql',
'host'
=& 'localhost',
'database'
=& 'piclist',
'username'
=& 'root',
'password'
=& '',
'charset'
=& 'utf8',
'collation' =& 'utf8_unicode_ci',
'prefix'
=& '',
'pgsql' =& array(
'driver'
=& 'pgsql',
'host'
=& 'localhost',
'database' =& 'forge',
'username' =& 'forge',
'password' =& '',
'charset'
=& 'utf8',
'prefix'
=& '',
'schema'
=& 'public',
'sqlsrv' =& array(
'driver'
=& 'sqlsrv',
'host'
=& 'localhost',
'database' =& 'database',
'username' =& 'root',
'password' =& '',
'prefix'
=& '',
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
'migrations' =& 'migrations',
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
'redis' =& array(
'cluster' =& false,
'default' =& array(
'host'
=& '127.0.0.1',
'port'
'database' =& 0,
第三部(数据库建立):
关于数据库表的建立,这里不使用手动建立的方法了,laravel提供了强大的数据库版本管理功能,不但可以以php语言简单地实现数据库建表工作,还可以通过数据库迁移,明确了数据库版本更新的规则,给未来回滚或者重置提供了方法。
在cmd(windows系统下)中,运行php&artisan migrate:make
create_tablename_table,tablename是所要建立的表名,这里运行三个命令,我们的博客需要建立三张表:
&php artisan migrate:make create_users_table
&php artisan migrate:make create_pictures_table
&php artisan migrate:make create_comments_table
这时候进入app\database\migrations,会发现带上了时间戳和表名的三个php文件。
接下来,我们就要在这三个文件书写我们的建表规定,为了满足我们的需求,需要的建表语言如下:
1#......xxxx_xx_xx_xxxxxx_create_users_table.php这里定义我们要创建的用户数据表,数据库相关的内容都可以在laravel mannual中找到,多读文档对编写代码非常有帮助。
use Illuminate\Database\Schema\B
use Illuminate\Database\Migrations\M
class CreateUsersTable extends Migration {
* Run the migrations.
* @return void
public function up()
Schema::create('users', function (Blueprint $table) {
$table-&increments('id');
$table-&string('username');
$table-&string('password');
$table-&string('email');
$table-&string('remember_token');
$table-×tamps();
* Reverse the migrations.
* @return void
public function down()
Schema::table('users', function (Blueprint $table) {
$table-&drop();
2#......xxxx_xx_xx_xxxxxx_create_pictures_table.php这里定义我们的图片表,图片是该博客的主内容,它由唯一一个用户所发,可被任意多个用户评论,$table-&binary()函数可以指定一个mysql中blob类型的项,用它可以存储图片数据(此处已修改,不直接存储图片到数据库,而是存图片的路径)。
当一个新图片被上传时,首先在服务端以时间戳和文件名为信息唯一创建一个图片文件,将它的路径存入数据库,放置了数据库端的大量读写。
图片作为一个主题,支持全局搜索,可以搜索标题或者描述中出现的词。
use Illuminate\Database\Schema\B
use Illuminate\Database\Migrations\M
class CreatePicturesTable extends Migration {
* Run the migrations.
* @return void
public function up()
Schema::create('pictures', function(Blueprint $table){
$table-&increments('id');
$table-&string('title');
$table-&text('description');
$table-&binary('image');
$table-&unsignedInteger('user_id');
$table-&unsignedInteger('comment_count');
$table-×tamps();
$table-&engine = 'MyISAM';
DB::statement('ALTER TABLE pictures ADD FULLTEXT search(title, description)');
* Reverse the migrations.
* @return void
public function down()
Schema::table('pictures', function (Blueprint $table) {
$table-&dropIndex('search');
$table-&drop();
3#......xxxx_xx_xx_xxxxxx_create_comments_table.php这是我们的评论表单,它由唯一一个用户发出,评论在唯一一张图片下,设计相对比较简单。
use Illuminate\Database\Migrations\M
use Illuminate\Database\Schema\B
class CreateCommentsTable extends Migration
* Run the migrations.
* @return void
public function up()
Schema::create('comments', function (Blueprint $table) {
$table-&increments('id');
$table-&unsignedInteger('picture_id');
$table-&string('commenter');
$table-&string('email');
$table-&text('comment');
$table-&boolean('approved');
$table-×tamps();
* Reverse the migrations.
* @return void
public function down()
Schema::drop('comments');
编辑并保存好这三个文件后,我们已经完成了对数据表创建的描述,接下来就要把这些描述应用在我们的MySQL数据库上了,在命令行输入:
php artisan migrate此时查看MySQL数据库,发现建立了三个数据表+一个数据迁移表,分别是我们创建的网页需要的表,和一张表示我们数据库迁移记录的表。
(注:每当我们需要对数据库的结构进行改变,就可以使用artisan命令创建一个迁移文件,定义我们的迁移过程,比如新建属性,修改表名等等,然后应用迁移命令进行数据库结构的改变,这样的习惯有助于当我们需要回滚数据库的历史版本时,可以更方便地操作和维护,具体可以参看)
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:51810次
排名:千里之外
原创:18篇
评论:30条
(2)(6)(7)(3)(1)扫描二维码用手机看文章求高人给一个用PHP+MySQL实现的简单的数据库查询功能的PHP和HTML代_php吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:56,299贴子:
求高人给一个用PHP+MySQL实现的简单的数据库查询功能的PHP和HTML代收藏
快试试吧,可以对自己使用挽尊卡咯~◆◆
求高人给一个用PHP+MySQL实现的简单的数据库查询功能的PHP和HTML代码,数据库已经做好,如下:drop database
create table GameSearch(&&&&
GameID int(4) NOT NULL auto_increment,&&&&
GameName varchar(50) NOT NULL,&&&&
GameType varchar(50) NOT NULL,&&&&
CompanyName varchar(50) NOT NULL,&&&&
ReleaseYear int,&&&&
GamePlatform varchar(50)NOT NULL,&&&&
Language varchar(20) NOT NULL,&&&&
PackageType varchar(50) NOT NULL,&&&&&
MediaType varchar(20) NOT NULL,&&&&&&&&&
GamePrice float,&&&&
PRIMARY KEY (GameID));&&
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Pro Evolution Soccer 2010','Sports','Konami','2009','PS3','Japanese','Lite','DVD','15.50');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Need For Speed 13','Sports','EA Sports','2010','PC','English','Deluxe','BlueRay','20.60');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Red Alert 3','RTS','EA Games','2009','XBOX360','English','Limited','DVD','25.50');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Air Combat X','AirFighting','Namco','2006','PSP','Japanese','Normal','CD','18.80');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Resident Evil 4','Adventure','Capcom','2008','PS2','Japanese','Normal','DVD','20.60');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Sword','RPG','Softstar','2005','PC','Chinese','Limited','CD','27.50');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('FIFA 2010','Sports','EA Sports','2009','PC','English','Lite','DVD','17.80');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Grand Theft Auto IV','Action','Rockstar Games','2009','XBOX360','English','Normal','BlueRay','30.40');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Super Street Fighter IV','Fighting','Capcom','2009','XBOX360','Japanese','Normal','DVD','16.80');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Silent Hill 5','Adventure','Konami','2010','PS3','English','Deluxe','DVD','29.80');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Just Dance','Action','Ubisoft','2008','Wii','French','Normal','CD','19.20');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('New Super Mario','Action','Nintendo','2008','Wii','Japanese','Deluxe','CD','12.50');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Loco Roco 2','Action','Sony','2008','PSP','Japanese','Normal','CD','14.50');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Monster Hunter 2','RPG','Capcom','2008','PSP','English','Deluxe','DVD','32.80');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Final Fantasy XIII','RPG','Square Enix','2009','PS3','Japanese','Lite','BlueRay','36.80');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('Battlefield2','Action','EA Games','2007','PS3','English','Deluxe','BlueRay','33.80');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,PackageType,MediaType,GamePrice) values ('The Legend of Zelda','Adventure','Nintendo','2005','DS','German','Deluxe','CD','18.50');
insert into GameSearch (GameName,GameType,CompanyName,ReleaseYear,GamePlatform,Language,
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或}