the issue i am having is with 
lines 56; 63; 87; 107; 127 
 
My sql version is 4.1.10(ga) 
php5 version is the latest available 
 
 
I have built this in quanta;  if you want the line numbers just past 
into quanta and you'll save yourself a lot of time. 
--------------------------------------------------------------------- 
here is the error output 
 
Warning: mysql_result(): supplied argument is not a valid MySQL 
result resource in /www/selentry.php on line 56 
  
 Warning: mysql_num_rows(): supplied argument is not a valid MySQL 
result resource in /www/selentry.php on line 63 
  
 Warning: mysql_num_rows(): supplied argument is not a valid MySQL 
result resource in /www/selentry.php on line 87 
  
 Warning: mysql_num_rows(): supplied argument is not a valid MySQL 
result resource in /www/selentry.php on line 107 
  
 Warning: mysql_num_rows(): supplied argument is not a valid MySQL 
result resource in /www/selentry.php on line 127 
   
 
Showing Record for  
 
 
 
 
 Select Another 
 
  
 
Main Menu | Phone Menu | Add Entry | Delete Entry | View Entries  
 
--------------------------------------------------------------------- 
 
Here is the code. 
<?php 
//Connect to database 
$conn = mysql_connect("localhost", "someuser", "somepass") 
        or die(mysql_error()); 
mysql_select_db("PhoneBook",$conn) or die(mysql_error()); 
 
if ($_POST[op] != "view") { 
        //Haven't seen the form, so show it 
        $display_block = "<H1>Select an Entry</H1>"; 
         
        //get parts of records 
        $get_list = "select id, concat_ws(', ', l_name, f_name) as 
display_name 
                from master_name order by l_name, f_name"; 
        $get_list_res = mysql_query($get_list) or 
die(mysql_error()); 
         
        if (mysql_num_rows($get_list_res) < 1) { 
        //no records 
        $display_block .= "<P><EM>Sorry, no records to 
select!</EM></P>"; 
         
        } else { 
                //has records, so get results and print in a form 
                $display_block .= " 
                <FORM METHOD=\"POST\" ACTION=\"$_SERVER[PHP_SELF]\"> 
                <P><STRONG>Slect a record to view:</STRONG></BR> 
                <SELECT NAME=\"sel_id\"> 
                <OPTION VALUE=\"\"> --SELECT ONE-- </OPTION>"; 
                 
                while ($recs = mysql_fetch_array($get_list_res)) { 
                        $id = $recs['id']; 
                        $display_name = 
stripslashes($recs['display_name']); 
                         
                        $display_block .= "<OPTION VALUE=\"$id\"> 
                                $display_name</OPTION>"; 
                } 
                $display_block .= " 
                </SELECT> 
                <INPUT TYPE=\"hidden\" NAME=\"op\" VALUE=\"view\"> 
                <P><INPUT TYPE=\"submit\" NAME=\"submit\" 
                        VALUE=\"View Selected Entry\"></P> 
                </FORM>"; 
        } 
 
} else if ($_POST[op] == "view") { 
         
        //Check for required fields 
        if ($_POST[sel_id] == "") { 
                header("Location: selentry.php"); 
                exit; 
        } 
         
        //Get master_info 
        $get_master = "select contact_ws(' ', f_name, l_name) as 
display_name 
                from master_name where id = $_POST[sel_id]"; 
        $get_master_res = mysql_query($get_master); 
        $display_name = stripslashes(mysql_result($get_master_res, 
                0, 'display_name')); 
        $display_block = "<H1>Showing Record for 
$display_name</H1>"; 
        //Get All addresses 
        $get_addresses = "select address, city, state, zipcode, type 
                from address where master_id = $_POST[sel_id]"; 
        $get_address_res = mysql_query($get_addresses); 
                         
        if (mysql_num_rows($get_addresses_res) > 0) { 
         
                $display_block .= "<P><STRONG>Address:</STRONG><BR> 
                <UL>"; 
         
                while ($add_info = 
mysql_fetch_array($get_addresses_res)) { 
                        $address = $add_info[adress]; 
                        $city = $add_info[city]; 
                        $state = $add_info[state]; 
                        $zipcode = $add_info[zipcode]; 
                        $address_type = $add_info[type]; 
                 
                        $display_block .= "<LI>$address $city $state 
$zipecode 
                                ($address_type)"; 
                } 
         
                $display_block .= "</UL>"; 
        } 
         
        //Get All Telephone Numbers 
        $get_tel = "select tel_number, type, from telephone where  
                master_id = $_POST[sel_id]"; 
        $get_tel_res = mysql_query($get_tel); 
                         
        if (mysql_num_rows($get_tel_res) > 0) { 
         
                $display_block .= 
"<P><STRONG>Telephone:</STRONG><BR> 
                <UL>"; 
         
                while ($tel_info = mysql_fetch_array($get_tel_res)) 
{ 
                        $tel_number = $tel_info[tel_number]; 
                        $tel_type = $tel_info[type]; 
                 
                        $display_block .= "<LI>$tel_number 
($tel_type)"; 
                } 
         
                $display_block .= "</UL>"; 
        } 
         
        //Get All Fax Numbers 
        $get_fax = "select fax_number, type, from fax where  
                master_id = $_POST[sel_id]"; 
        $get_fax_res = mysql_query($get_fax); 
                         
        if (mysql_num_rows($get_fax_res) > 0) { 
         
                $display_block .= "<P><STRONG>Fax:</STRONG><BR> 
                <UL>"; 
         
                while ($fax_info = mysql_fetch_array($get_fax_res)) 
{ 
                        $fax_number = $fax_info[fax_number]; 
                        $fax_type = $fax_info[type]; 
                 
                        $display_block .= "<LI>$fax_number 
($fax_type)"; 
                } 
         
                $display_block .= "</UL>"; 
        } 
         
        //Get All E-Mail 
        $get_email = "select email, type, from email where  
                master_id = $_POST[sel_id]"; 
        $get_email_res = mysql_query($get_email); 
                         
        if (mysql_num_rows($get_email_res) > 0) { 
         
                $display_block .= "<P><STRONG>Email:</STRONG><BR> 
                <UL>"; 
         
                while ($email_info = 
mysql_fetch_array($get_email_res)) { 
                        $email_number = $fax_info[email]; 
                        $email_type = $fax_info[type]; 
                 
                        $display_block .= "<LI>$femail 
($email_type)"; 
                } 
         
                $display_block .= "</UL>"; 
        } 
         
        //Get Personal Note 
        $get_notes = "select note from personal_notes where  
                master_id = $_POST[sel_id]"; 
        $get_notes_res = mysql_query($get_notes); 
                         
        if (mysql_num_rows($get_notes_res) == 1) { 
                $note = 
n12br(stripslashes(mysql_result($get_notes_res,0,'note'))); 
         
                $display_block .= "<P><STRONG>Personal 
Notes:</STRONG><BR>$note"; 
        } 
                 
        $display_block .= "<BR><BR><P align=center> 
                <A HREF=\"$_SERVER[PHP_SELF]\">Select 
Another</A></P>"; 
} 
?> 
 
<HTML> 
<HEAD> 
<TITLE>Select Entry</TITLE> 
</HEAD> 
<BODY> 
<?php echo $display_block; ?> 
<HR> 
<!--Footer Menu--> 
<P><A HREF="index.php">Main Menu</A> | <A HREF="mymenu.php">Phone 
Menu</A>  
        | <A HREF="addentry.php">Add Entry</A> | <A 
HREF="delentry.php">Delet Entry</A> |  
        Veiw Entries 
</BODY> 
</HTML> 
 
Thank you, 
Matthias Urankar 





The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to