PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 26th, 2000, 11:40 AM
chayani chayani is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 9 chayani Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: < 1 sec
Reputation Power: 0
I am trying to serach a record from mysql table with php query.

following is the code.

when we use mysql_select_db();
what should be the datbase name.

when we use mysql_quer() we give table name.
how this table name is different from the databse name<html>

<head>

<title> SAVDHAN.COM SEARCH </title>
</head>

<body bgcolor="#C0C0C0" topmargin="40" leftmargin="50">

<h1 ALIGN=CENTRE><font color="#FF0000">SEARCH ON INDIVIDUAL NAME</font> </h1>

<p>&nbsp;</p>

<hr>

<hr>

<?php

/* Check that Fst name or sr name is inserted for serach */
if ($submit)
{

if (!$Fst_name & !$Sr_name)

{

$error = "Sorry! Enter the LASt NAME or FIRST NAME to get the serch Result!";

}

else

{

// process form

//echo "Thank You!";


// Connect to MySQL database and open the required table

$db = mysql_connect("localhost", "root");

mysql_select_db("test1",$db);


$result = mysql_query ("SELECT * Amount FROM test1 WHERE First_name = "Fst_name",$db);


if ($myrow = mysql_fetch_array($result))
{

echo "<table border=1>n";


do {

// list the search details if it is an indiviual

if (!$myrow["Comp_name"])

{
echo "<tr><td>Name</td><td>Bank Name</td><td>Amount</td></tr>n";


printf("<tr><td>%s %s</td><td>%s</td><td>%s</td></tr>n", $myrow["First_name"], $myrow["Sur_name"], $myrow["Bank_name"], $myrow["Amount"]);

}


} while ($myrow = mysql_fetch_array($result));


echo "</table>n";]=74
}


}

}

?>


<form method="POST" action="<?php echo php_self ?>">

<p>Last Name <input type="text" size="20"
maxlength="40" name="Sr_name"> </p>

<p>First Name <input type="text" size="20"
maxlength="40" name="Fst_name"></p>

<p><input type="submit" name="indv_search" value="Search"> <input
type="reset" name="indv_rest" value="Reset"></p>

</form>

<p>&nbsp;</p>

<hr>

<hr>
</body>
</html>



Reply With Quote
  #2  
Old March 26th, 2000, 01:13 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
The database is the name of the database, the table name is the name of the table. A database is a collection of tables. It hasn't any records of it's own:

Database
|
--Table
| |
| -- Records
| |
| -- Columns
|
--Table
| |
| -- Records
| |
| -- Columns

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP query on mysql

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap