<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'how to correct search key' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'how to correct search key' posted on the 'PHP' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 05:46:13 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 05:46:13 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>how to correct search key</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/393624/393624/how-to-correct-search-key/</link>
      <description>my problem is the keyword not working.&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
include('connect_login.php');&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;div class="post"&amp;gt;&lt;br /&gt;
					&amp;lt;h1&amp;gt;&amp;amp;nbsp;&amp;lt;/h1&amp;gt;&lt;br /&gt;
					&amp;lt;div align="center"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
					&amp;lt;table width="500" border="1" bordercolor="#9E8C83"&amp;gt;&lt;br /&gt;
                      &amp;lt;tr&amp;gt;&lt;br /&gt;
                        &amp;lt;td bordercolor="#864243" bgcolor="#0099FF"&amp;gt;&amp;lt;div align="center" class="style4"&amp;gt;ID&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                        &amp;lt;td width="300" bordercolor="#864243" bgcolor="#0099FF"&amp;gt;&amp;lt;div align="center" class="style4"&amp;gt;Title&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                        &amp;lt;td bordercolor="#864243" bgcolor="#0099FF"&amp;gt;&amp;lt;div align="center" class="style4"&amp;gt;Student Name&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                      &amp;lt;/tr&amp;gt;&amp;lt;?&lt;br /&gt;
$title=$_POST['title'];&lt;br /&gt;
$query = "Select * from 'developer' where title='$title'";&lt;br /&gt;
$result = mysql_query($query);&lt;br /&gt;
while($result_row = mysql_fetch_row($result))&lt;br /&gt;
{&lt;br /&gt;
$input = $result_row[1];&lt;br /&gt;
}&lt;br /&gt;
if($input == "")&lt;br /&gt;
{ ?&amp;gt;&lt;br /&gt;
&amp;lt;meta http-equiv="refresh" content="0; url=searchdb.php" /&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;window.alert('You have inserted wrong title, please try again ...');&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{ &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                      &amp;lt;tr&amp;gt;&lt;br /&gt;
                        &amp;lt;td&amp;gt;&amp;lt;? echo $result_row[1]; ?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                        &amp;lt;td&amp;gt;&amp;lt;? echo $result_row[2]; ?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                        &amp;lt;td&amp;gt;&amp;lt;? echo $result_row[4]; ?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                      &amp;lt;/tr&amp;gt;     &lt;br /&gt;
                        &amp;lt;?&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
                    &amp;lt;/table&amp;gt;&lt;br /&gt;
			  &amp;lt;table width="500" height="200" border="0" align="center" bordercolor="#9E8C83"&amp;gt;&lt;br /&gt;
          &amp;lt;/table&amp;gt;&lt;br /&gt;
          &amp;lt;div align="center"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
	  &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
how to correct the code in order to display the output?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/393624/393624/how-to-correct-search-key/</guid>
      <pubDate>Sun, 12 Jul 2009 11:32:39 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: how to correct search key</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/393624/393810/re-how-to-correct-search-key/#393810</link>
      <description>&lt;pre class="sourcecode"&gt;
&amp;lt;?php
	include('connect_login.php');
?&amp;gt;

&amp;lt;div class="post"&amp;gt;
	&amp;lt;h1&amp;gt;&amp;amp;nbsp;&amp;lt;/h1&amp;gt;
&amp;lt;div align="center"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;table width="500" border="1" bordercolor="#9E8C83"&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td bordercolor="#864243" bgcolor="#0099FF"&amp;gt;&amp;lt;div align="center" class="style4"&amp;gt;ID&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;td width="300" bordercolor="#864243" bgcolor="#0099FF"&amp;gt;&amp;lt;div align="center" class="style4"&amp;gt;Title&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;td bordercolor="#864243" bgcolor="#0099FF"&amp;gt;&amp;lt;div align="center" class="style4"&amp;gt;Student Name&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;?
$title=$_POST['title'];
$query = "Select * from developer where title='$title'";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
if($num_rows  &amp;gt; 0){ 
	while($result_row = mysql_fetch_row($result)){
		//$input = $result_row[1];
		$all_data[] = $result_row;
	?&amp;gt;
		&amp;lt;tr&amp;gt;
			&amp;lt;td&amp;gt;&amp;lt;? echo $result_row[1]; ?&amp;gt;&amp;lt;/td&amp;gt;
			&amp;lt;td&amp;gt;&amp;lt;? echo $result_row[2]; ?&amp;gt;&amp;lt;/td&amp;gt;
			&amp;lt;td&amp;gt;&amp;lt;? echo $result_row[4]; ?&amp;gt;&amp;lt;/td&amp;gt;
		&amp;lt;/tr&amp;gt; 
	&amp;lt;?
	}
}else{ ?&amp;gt;
	&amp;lt;meta http-equiv="refresh" content="0; url=searchdb.php" /&amp;gt;
	&amp;lt;script&amp;gt;window.alert('You have inserted wrong title, please try again ...');&amp;lt;/script&amp;gt;
&amp;lt;?
}?&amp;gt;
&amp;lt;/table&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	Basically the code you have is correct.&lt;br /&gt;
	You have included your configuration,&lt;br /&gt;
	Extracted you php post variables from $_POST, although you may have to do some escaping  but that is along the way.&lt;br /&gt;
	You have created your query and gotten the result.&lt;br /&gt;
	&lt;br /&gt;
	It would be good to count the number of rows returned from the query, &lt;br /&gt;
		if it is more than zero, then write out all the results.&lt;br /&gt;
		else if it is equal to zero, then you have to do your page redirect, but I dont see any reason why.&lt;br /&gt;
		&lt;br /&gt;
		You might as well write a no result or no row message on the current page.&lt;br /&gt;
	&lt;br /&gt;
	Hope this helps.&lt;br /&gt;
	&lt;br /&gt;
	And please provide some feedback even if it don't.&lt;br /&gt;
	&lt;br /&gt;
	Thanks.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/393624/393810/re-how-to-correct-search-key/#393810</guid>
      <pubDate>Thu, 16 Jul 2009 19:26:12 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: how to correct search key</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/393624/393847/re-how-to-correct-search-key/#393847</link>
      <description>well, i have started from row 1 due to $title=$_POST['title'];&amp;lt;&amp;lt;&amp;lt;&amp;lt;according to this command has begun from this row. Also, the row zero is id no need to assign because it is auto_increment(auto adding). However, the error  are occur;&lt;br /&gt;
&lt;br /&gt;
mysql_fetch_row() : supplied argument is not a valid MySQL result resource &lt;br /&gt;
&lt;br /&gt;
via this line&lt;br /&gt;
while($result_row = mysql_fetch_row($result))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
thanks for your answer&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/393624/393847/re-how-to-correct-search-key/#393847</guid>
      <pubDate>Fri, 17 Jul 2009 10:57:13 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: how to correct search key</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/393624/393879/re-how-to-correct-search-key/#393879</link>
      <description>There is nothing wrong with the command, it is straigth forward, there must be something wrong with you configuration.&lt;br /&gt;
&lt;br /&gt;
Try this command &lt;br /&gt;
$result = mysql_query($query) or die('Query failed: ' . mysql_error());&lt;br /&gt;
if you dont get any error, then u know that there is something else wrong.&lt;br /&gt;
&lt;br /&gt;
Make sure that you have a database selected, in your config file using.&lt;br /&gt;
mysql_select_db('my_database') or die('Could not select database');&lt;br /&gt;
&lt;br /&gt;
also check that the configuration is correct? check for typographical errors.&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/393624/393879/re-how-to-correct-search-key/#393879</guid>
      <pubDate>Sat, 18 Jul 2009 20:11:03 -0700</pubDate>
      <category>PHP</category>
    </item>
  </channel>
</rss>