Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase 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 Codewalkers Forums Sponsor:
  #1  
Old August 5th, 2003, 09:03 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
PHP / SQL database Query problem...

Hi,

I have a problem with some code not working properly. The page uses a search box to serach for entries in a datbase table using a php ID call.

I just cant see why this does'nt work ...!

Here's the code..

<?php require("header2.php3"); ?>
<table cellspacing=1 cellpadding=2 border=0 width=600 valign=top background=bgplain.gif>

<tr><td colspan=2 bgcolor=#aedaff align=center valign=middle><font size=2 color=#003366><B>
Search Results</B>
</td></tr>
<?php require("db.php3"); ?>


<?


$result = mysql_query("select * FROM abstracts where titleab like '%$searchname%' or authors like '%$searchname%' or journal like '%$searchname%' or abstract like '%$searchname%'");



$numrows = mysql_num_rows($result);
if($numrows == 0) {

echo("<table width=600 background=bgplain.gif><tr><td align=center><br><b>There are no Abstracts in the database matching your search criteria please refine your search. &nbsp; <a href=abstracts.html><font color=orange>Go Back</a></b></td></tr></table>");
}
while($row = mysql_fetch_array($result)) {

echo("


<tr>
<td align=right valign=top width=25%>
<font face=arial size=1 color=orange>

<B>Title: </B>
</td>
<td align=left valign=top>
<font face=arial size=1 color=ffffff>

<B>$row[titleab]</B>
</td></tr>


<tr>
<td align=right valign=top width=25%>
<font face=arial size=1 color=orange>

<B>Authors: </B>
</td>
<td align=left valign=top>
<font face=arial size=1 color=ffffff>

$row[authors]
</td></tr>

<tr>
<td align=right valign=top width=25%>
<font face=arial size=1 color=orange>

<B>Journal/Conference: </B>
</td>
<td align=left valign=top>
<font face=arial size=1 color=ffffff>

$row[journal]
</td></tr>

<tr>
<td align=right valign=top width=25%>
<font face=arial size=1 color=orange>

<B>Date: </B>
</td>
<td align=left valign=top>
<font face=arial size=1 color=ffffff>

$row[date]
</td></tr>

<tr>
<td align=right valign=top>
&nbsp;
</td>
<td align=left valign=bottom>
<a href="abstractsmore.php3?id=$row[id]"><font face=arial size=1 color=orange><img src=images/bullet.gif border=0 > Complete Abstract </a>
</font></td></tr>




<tr><td colspan=2 align=right>&nbsp; <a href=abstracts.html><font color=#aedaff><img src=images/bulletback.gif border=0>&nbsp;<B>Go Back</a></b><P></td></tr>

");

}

?>
</table>
<?php require("footer2.php3"); ?>





Thanks in advance.

Ronan.

Reply With Quote
  #2  
Old August 5th, 2003, 12:01 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
RE: PHP / SQL database Query problem...

What is the specific problem you are having? No Output?, Error message? Let us know so we have more information to help troubleshoot.

Reply With Quote
  #3  
Old August 5th, 2003, 02:33 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: PHP / SQL database Query problem...

Hi,

Basically after you input your search identifier, say the name of an author or abstarct title, the result just returns the full list again.

so basically no search takes place....

Thanks in advance...

Reply With Quote
  #4  
Old August 5th, 2003, 02:40 PM
jaltiere jaltiere is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 55 jaltiere User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
Send a message via AIM to jaltiere
RE: PHP / SQL database Query problem...

did you make sure that your search string wasn't blank before you ran the query?

Reply With Quote
  #5  
Old August 5th, 2003, 02:51 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
RE: PHP / SQL database Query problem...

jaltiere makes a good point... are the search criteria every making it to the query? If not, then yes the full list would be output

try echoing the $searchname variable prior to running the query to see if there is a value.

I think that register globals is set to off in your php.ini file so you should try this.
[highlight=php]
<?
$searchname = $_POST['searchname']
?>
place this code just before the query and it should work. I would also include a check to see if the searchname variable has a value assigned to it before running the query.

Note, if you are using the GET method in your form, change $_POST above to $_GET

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > PHP / SQL database Query problem...


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




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

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




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek