MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 7th, 2005, 08:47 AM
john_k_o john_k_o is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 john_k_o User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 47 sec
Reputation Power: 0
Retreiving entry from database using PHP POST function

Hi all,

Just wondering if there is a way of retreiving a entry from a mysql
database using a post function from a previous html page on the site?

I am using:

$query = 'SELECT * FROM application ORDER BY id DESC LIMIT 1';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

at the moment but want to change it so it retreives an entry with a specific
name

eg. $Nameofapplicant from a previous POST function.

I have another PHP page that reteives the data from using this command:

?php echo $NameofApplicant;

is there a way of doing this

eg

SELECT * FROM application WHERE name_of_applicant = $NameofApplicant ??


Thanks
John

Reply With Quote
  #2  
Old April 7th, 2005, 08:55 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
PHP Code:
<?php
$NameofApplicant 
$_POST['NameofApplicant'];
$query "SELECT * FROM application WHERE name_of_applicant = '$NameofApplicant'";
$result mysql_query($query) or die('Query failed: ' mysql_error());
?>


I assume your variable is a String; I've surrounded it with quotes in the SQL.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Retreiving entry from database using PHP POST function


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT