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

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 August 4th, 2000, 10:29 PM
web2webmaster web2webmaster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Dallas, Texas USA
Posts: 9 web2webmaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to web2webmaster
Hi Guys,
I have a problem! I have this php script to search a MySQL database on my server. It is set up to check and see if a particular name is already in the database. If the name is in the database, It is set up to say, "WE ARE VERY SORRY! THE NAME THAT YOU HAVE SELECTED IS ALREADY REGISTERED. PLEASE TRY ANOTHER NAME." And then it prints a URL to take them back to the page to search again. If the result of the search is negative, It will redirect them to a registration page so that they can register the name. My question is, How do I make it display the search page automaticaly when the search results is poastive insted of all that "WE ARE VERY SORRY! THE NAME THAT YOU HAVE SELECTED IS ALREADY REGISTERED. PLEASE TRY ANOTHER NAME."? I will leave a copy of my script bellow for you to see.
<html>
<body>

<?php

mysql_connect (localhost, dbase, anerson1);

mysql_select_db (domainnames);

if ($domain_name == "")
{$domain_name = '%';}

$result = mysql_query ("SELECT * FROM aarp
WHERE domain_name LIKE '$domain_name'
");

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

do {
print $row["<CENTER>domain_name"];
print ("<P>");
} while($row = mysql_fetch_array($result));

print ("<CENTER>WE ARE VERY SORRY!</CENTER>");
print ("<P>");
print ("<CENTER>THE NAME THAT YOU HAVE SELECTED IS ALREADY REGISTERED.</CENTER>");
print ("<P>");
print ("<CENTER>PLEASE TRY ANOTHER NAME.</CENTER>");
print ("<P>");
print ("<CENTER><a href="http://liberty.phpwebhosting.com/~dbase/search/.aarp2.html">CLICK HERE TO SEARCH AGAIN!</a></CENTER>");
print ("<P>");


} else {include("http://liberty.phpwebhosting.com/~dbase/register/.afcregister.html");}


?>

</body>
</html>

Reply With Quote
  #2  
Old August 5th, 2000, 11:58 PM
firepages's Avatar
firepages firepages is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: Perth West Australia
Posts: 741 firepages User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Why not just put it all on one form.

<?if ($submit){ // IF SUBMIT BUTTON PRESSED //
do mysql_query here - assume $result carries sucess or failure }?>

<? if(!$submit | | $result){?> //IF SUBMIT NOT PRESSED YET OR DOMIAN ALREADY TAKEN DISPLAY INPUT FORM//

<?if ($result){ .... sorry please try again etc....}?>// DISPLAY ONLY IF DOMAIN TAKEN//

form for domain request input here...action="<? echo $PHP_SELF;?>">
<input type="submit" name="submit" value="search">

<? } else { ?> //IF SUBMIT PRESSED OR RESULT IS FALSE //

<? include("registration.form")?>

<? } ?>//END ELSE//

------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL

Reply With Quote
  #3  
Old August 6th, 2000, 11:51 AM
web2webmaster web2webmaster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Dallas, Texas USA
Posts: 9 web2webmaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to web2webmaster
Ha Guys, I found the answer! It works great.<html>
<body>

<?php

mysql_connect (localhost, dbase, anerson1);

mysql_select_db (domainnames);

if ($domain_name == "")
{$domain_name = '%';}

$result = mysql_query ("SELECT * FROM aarp
WHERE domain_name LIKE '$domain_name'
");

if ($row = mysql_fetch_array($result))
{ include "http://liberty.phpwebhosting.com/~dbase/search/.aarp2.html"; }
else
{ include"http://liberty.phpwebhosting.com/~dbase/register/.aarpregister.html"; }

?>

</body>
</html>


Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > php to MySQL and back


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