恩,LZ,其实没人愿意写代码的,
LZ还是自己动手写写,锻炼锻炼自己.
遇到问题,你贴出来,我们帮你解决..

解决方案 »

  1.   

    直接用dreamweaver就自动生成出来了...这还用写?
      

  2.   

    (1)
    <?php
      $db=mysql_connect("localhost","root","mysql");   
      mysql_select_db("mb",$db);   
      $sqltxt="select*   from   user";   
      $Result=mysql_query($sqltxt,$db);   
      while($myrow=mysql_fetch_row($Result))   
        {   
        echo   $myrow[1];   
        }    
    ?>这样就可连上数据库,
    并输出 表内容  smb
    (2)
    do_login01.php
       $id=intval($_POST[id]);
       $name=$_POST[name];
      
      $db=mysql_connect("localhost","root","mysql");   
      mysql_select_db("mb",$db);   
      $sqltxt="select * from user where name=".$name;   
      $Result=mysql_query($sqltxt,$db);   
      $myrow=mysql_fetch_row($Result);  
      if($myrow.next()){
                 if($myrow.getint(".$id.").equals(id))
                         {  
                                           echo   "success";  
                            }
                                 
                 else  
                 echo  "!=id";      
                     
                      }              else
                     
                      echo  " $myrow.next() is wrong "; 
                   这时怎么就进不了index.php呢,
    地址是对的,http://localhost/exe/do_login01.php
    .next() is wrong 
    应该是这几句有问题
      $sqltxt="select * from user where name=".$name;   
      $Result=mysql_query($sqltxt,$db);   
      $myrow=mysql_fetch_row($Result);  
      if($myrow.next()){
                 if($myrow.getint(".$id.").equals(id))
    帮我看看怎么改??
      

  3.   

    地址是对的,http://localhost/exe/do_login01.php 
    输不了 success
    输出 .next() is wrong
     应该是这几句有问题 
      $sqltxt="select * from user where name=".$name;  
      $Result=mysql_query($sqltxt,$db);  
      $myrow=mysql_fetch_row($Result);  
      if($myrow.next()){ 
                if($myrow.getint(".$id.").equals(id)) 
    帮我看看怎么改??
    谢谢
      

  4.   

    还没用过.next()那,呵呵~~..怎么感觉有点像用JSP的意思  $sqltxt="select * from user where name=".$name;  //name= name like?
      $Result=mysql_query($sqltxt,$db);  
      $myrow=mysql_fetch_row($Result);
      print_r($myrow);exit;先看看是什么东西,就能找到你要的东西了!
      

  5.   

    sql中where 应该怎么写呢,
    if 
    又应该怎么写呢,
      

  6.   

    $myrow=mysql_fetch_row($Result); 
      if($myrow.next()){
                if($myrow.getint(".$id.").equals(id)) lz java转过来的吧,,php里面调用类的方法用->$myrow=mysql_fetch_row($Result); 
      if($myrow.next()){
                if($myrow.getint(".$id.").equals(id)) 
    改为:while ($myrow=mysql_fetch_row($result)){

    for($r=0;$r<count($myrow);$r++){
    echo $row[$r];
    }
    $sqltxt="select * from user where name=".$name;  
    改为:
    $sqltxt="select * from user where name = "'.$name.'" ";  再试试看!!
      

  7.   

    where (字段)+ 判断符 + 值
     
    楼主还是多看下基础知识吧
      

  8.   

    上面  echo $row[$r]; 手打,失误
    改为  echo $myrow[$r]; 
      

  9.   

    $sqltxt="select * from user where name = '".$name."' ";  
    .为连接字符串的符号, '".$name."'  单引在外,双引在内。
      

  10.   

    http://topic.csdn.net/u/20080722/11/6fe3f52a-4ca0-4833-9c0f-1cee93cc718c.html
    没事的话,看看别人的登录代码
      

  11.   

     谢谢18楼 已连好,
    15楼的只是显示,没有判断ID呀,怎么根据name去判断ID是否等于表中的ID呢,
    就是下面的
     $myrow=mysql_fetch_row($Result); 
      if($myrow.next()){
                 if($myrow.getint('".$id."').equals(id))
    怎么修改。。
    谢谢
      

  12.   

    成功的代码,  
     $id=intval($_POST[id]);
       $name=$_POST[name];
      
      $db=mysql_connect("localhost","root","mysql");   
       mysql_select_db("mb",$db);   
      $sqltxt="select*   from   user where name='".$name."'";   
      $Result=mysql_query($sqltxt,$db);   
      $row = mysql_fetch_array($Result); 
        $iddb  =$row[0]; 
        $namedb =$row[1]; 
    if($iddb == $id) 

    echo ("登陆成功"); 
    }
    else

      echo ("登陆失败"); 

    谢谢大家,