473,322 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Newbie needs advice on query search

Hi, all of you! I am new to this community. I am a web designer and a friend of mine and I have a server and manage websites (mostly ours but also a few clients). I manage the sites and he does the database management. My friend, an expert at javascript and java programming, is burning out on programming and he doesn't want to do it anymore. I'm stuck, on my own.

So ... now I have to learn PHP (can't use CGI) and database management. I have no problem accessing the database and managing records, and I have no problem connecting to the database with scripts, but I am just learning how to query and return results.

I have been pulling my hair out for a week trying to figure out the following:

I have three independent searches on one page. Each search will call a separate page (I think). On this same page, there are two text searches. I need to be able to have success at the simplest text search first before I can move on to the other text search and the drop down menu search.

My first query needs to result in three fields being extracted from the database table. In this case it is town, number, and sub_number. The results need to return on a page in rows (unlimited) but each hyperlinked. These hyperlinks will be links to internal HTML pages. That's it. I just need to know the proper query syntax and code. If I can make this work, then I will have a better understanding about how to progress further, especially trying to succeed with three searches from one page. Many thanks to anyone who can help me.
Nov 10 '06 #1
2 1410
exoskeleton
104 100+
hi sir, i will try to help ...here's the logic...

page1.html:
[HTML]
<form name="form1" method="post" action="page2.php">

firstname: <input name="firstname" type="text" id="firstname">
lastname: <input name="lastname" type="text" id="lastname">
<input type="submit" name="Submit" value="Submit">
</form>
[/HTML]

page2.php
[PHP]
// database connection
// codes here............
// getting the entry from page1
if (isset($_POST['Submit'])) {

$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];

$SQL="SELECT * FROM tbl_name WHERE column_uname = '$firstname' AND column_lname = '$lastname'";

$Execute = @mysql_query($SQL) or die(@mysql_error());

while ($field = @mysql_fetch_array($Execute)) {

// assigning value to variable from the result
$firstname = $field['column_uname'];
$lastname = $field['column_lname'];

// output the result
echo $firstname;
echo $lastname;
// break
echo "<br />";

} // End while
} // End if

[/PHP]

Hope it helps a little sir...Good Luck!!!
More power...
Nov 11 '06 #2
Dear exoskeleton,

Thank you very much! I spent a week looking for this, and even paid a few dollars for help at Experts Exchange, but it was like pulling teeth to get my "Expert" to give me some proper code. Great job! Thanks a mil!

Paul Revere
Nov 15 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like...
32
by: Alan Silver | last post by:
Hello, I shamefully admit to be an old web designer, from before the days of CSS. In those heady days, tables were king and were used for every possible kind of alignment. When CSS came along,...
4
by: areese801 | last post by:
i am using a website with a form that passes criteria to a javascript to run a query rather than just appending my criteria to parts of the URL. i need to import a bunch of records into MS...
6
by: jim | last post by:
Is anyone able to provide me with a link to useful documentation or just outright explain to me how to set query parameters dynamically? I'm really new to Access and databases in general but I...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
2
by: gozu | last post by:
Here is my query: SELECT departments.department_name AS "Department name", locations.STREET_ADDRESS AS "Mailing address", locations.city, locations.state_province, locations.postal_code FROM...
0
by: deeak | last post by:
Hi All, I have set of strings in the db2 table and two range keys to search. I have to finds strings the table which would be in between the range of keys defined. Strings in the colum to...
0
by: Rauf Sarwar | last post by:
Originally posted by dreimer You have to use ODBC/ADO etc to connect to the database. I don't know the exact syntax but you can search in comp.lang.visual.basic NG. Another suggestion.... dump...
5
by: SharkD | last post by:
Hi! I'm a total newbie when it comes to ASP (or any type of server-side programming). I want to start a project that does the following: 1. query Wikipedia for information regarding...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.