TechSpott - Computer and technology forums

Go Back   TechSpott - Computer and technology forums > Webmasters > Database Management > MySQL
MySQL Forum dedicated to the world's most popular open source database engine.

Reply
 
Thread Tools Display Modes
Old April 9th, 2010, 02:06 PM   #1 (permalink)
Gaylord
Guest
 
Posts: n/a
Default how do i get this php script to print out a result from a mysql database?

this is what i have so far..all the declaired variables are from a html form..
原帖地址: TechSpott - Computer and technology forums http://www.techspott.com//showthread.php?p=5735

<html>
<head>
<title>Search Results</title>
<head>
<body>
<?
//establish connection with database system
$conn=mysql_connect(INFO GOES HERE);
mysql_select_db(NAME GOES HERE, $conn);

//read info from form and pass it to db
$searchData=$_REQUEST['searchData'];
$uniRep=$_REQUEST['ur'];
$orgRep=$_REQUEST['or'];
$interaction=$_REQUEST['int'];


//determine which radio button is checked and generates SQL query to use
if ($uniRep = 'true'){
$sql = "SELECT * FROM uniRep LIKE '%$searchData%'";
}
else if ($orgRep = 'true'){
$sql = "SELECT * FROM orgRep LIKE '%$searchData%'";
}

else if ($interaction = 'true'){
$sql = "SELECT * FROM interaction LIKE '%$searchData%'";
}

$result=mysql_query($sql);
  Reply With Quote Share with Facebook
Reply

Bookmarks

Tags
database, mysql, php, print, result, script


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update MySQL database through PHP form? selfrob MySQL 0 April 8th, 2010 01:07 PM
Is there a Windows version of MySQL or other database program? Cully W MySQL 0 April 7th, 2010 08:33 PM
i don't have access to mysql database, any other alternatives? siekkwang_cin MySQL 1 April 4th, 2010 03:10 AM
Multiple PHP Scripts in 1 MySQL Database? Robert M PHP 0 April 4th, 2010 02:56 AM
I have a mysql database on a usb stick. How can I put it on a mysql jglw21 MySQL 0 April 2nd, 2010 01:49 AM

 
Forum Stats
Members: 14,375
Threads: 20,384
Posts: 27,874
Total Online: 43

Newest Member: AAccedlyGolo

Latest Threads

Advertisements

Support our advertisers!

Amazon
Sears
Macys
1800flowers.com
Drugstore.com


Carbonite Online-Backups
Tiger Direct
Tech Depot
Buy.com
Office Depot
Fatcow
HostGator


TripsNow.us
Marriott
Expedia
CheapTickets.com
OneTravel
Hotwire

Are you a Fan?

Share this on Facebook

Tag Cloud

Partner Links


Contact Us - Home - Archive - Privacy Statement - Top - Copyright © 2009-2010, TechSpott - All times are GMT -4. Time is 09:11 PM

Powered by vBulletin® Copyright © Jelsoft Enterprises Ltd. :: SEO by vBSEO