Jump to content

Search Field


ipPHPadmin

Recommended Posts

Hello everyone,

 

I am trying to search through a table in my database using a form.  When the form redirects to this page it's just automatically running through the if statement no matter what. Any ideas? Thanks in advance.

 

 

$HANDI_ID = $_REQUEST["HANDI_ID"];

 

$query = mysql_query("SELECT * FROM Handicraft WHERE HANDI_ID = '".$HANDI_ID."'");

$numrows = mysql_num_rows($query);

 

echo $HANDI_ID;

 

if($numrows != 1)

{

?><h2> Please enter a valid handicraft number. </h2>

<meta HTTP-EQUIV="REFRESH" content="5; url=http://www.integratedpeople.org">

<?php

}

else

{ ----code i want to display---- }

Link to comment
Share on other sites

I actually got it past that part now, not exactly sure how though.  Now I can't get the third table (Artisan information) table to display.  It cuts off at the 'echo "teset" .$ART_ID;' line.  It outputs the teset but not the $ART_ID value and from there the rest of the code doesn't display.  I made the text red where the problem is starting.  Thanks for the help.

 

 

 

 

$HAND_ID = $_REQUEST["HANDI_ID"];

 

$query = mysql_query("SELECT * FROM Handicraft WHERE HANDI_ID = '$HAND_ID'");

$numrows = mysql_num_rows($query);

 

if($numrows != 1)

{

?><h2 align="center"> Please enter a valid handicraft number. </h2>

<meta HTTP-EQUIV="REFRESH" content="5; url=http://www.integratedpeople.org">

<?php

}

else

{ //Start handicraft table

while(mysql_fetch_array($query))

{

$ART_ID = $row["ART_ID"];

?><h2 align="center"> Handicraft found!</h2>

<table align = "center" width = "90%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;">

<tr>

<td align="center">Picture here</td>

<td align="center"><b>Handicraft ID: </b> <?php echo $HAND_ID; ?></td>

</tr>

</table><?php

 

$HandiQuestions = mysql_query("SELECT * FROM HandicraftQuestion ORDER BY HCQ_ID");

?>

<div class="padded">

<table  align = "left" width="35%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;">

<?php

while ($row = mysql_fetch_array($HandiQuestions))

{

$QID = $row["HCQ_ID"];

$Ques = $row["HCQ_Question"];

?>

<tr>

<td valign="top" align="left" height="70px"> <?php echo "<b>".$QID. ".</b> ".$Ques; ?> </td>

</tr>

<?php

}?></table></div><?php

 

$answers = mysql_query("SELECT * FROM HandicraftAnswer WHERE HANDI_ID = '".$HAND_ID."' ORDER BY HCQ_ID");

?>

<div class="pad">

<table align = "right" width = "35%"  border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;">

<?php

while ($row = mysql_fetch_array($answers))

{

$ans = $row["HCAN_Answer"];

?>

<tr>

<td valign="top" align="left" height="70px"> <?php echo $ans; ?> </td>

</tr>

<?php

}?></table></div><?php

 

//Start Artisan table

 

echo "teset" .$ART_ID;

$ArtQuery = mysql_query("SELECT * FROM Artisan WHERE ART_ID = '".$ART_ID."'");

while($row = mysql_fetch_array($ArtQuery))

{

$A_Name = $row["ART_Name"];

 

?>

<table align = "center" width = "85%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;">

<tr>

<td align="right" width="50%">Artisan Name:</td>

<td align="left" width="50%"><?php echo $A_Name; ?> </td>

</tr>

<tr>

<td align="right" width="50%">Artisan ID:</td>

<td align="left" width="50%"><?php echo $ART_ID; ?></td>

</tr>

</table>

 

<?php

 

$QuestionQuery = mysql_query("SELECT * FROM ArtisanQuestion ORDER BY ARQ_ID")or die ("Error retrieving artisan questions." . mysql_error());

 

?>

<div class="padded">

<table  align = "left" width="35%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;">

<?php

while ($row = mysql_fetch_array($QuestionQuery))

{

$QuesID = $row["ARQ_ID"];

$Ques = $row["ARQ_Question"];

 

?>

<tr>

<td align="left" height="50px"><?php echo $QuesID. ". ".$Ques; ?></td>

</tr>

<?php

}?></table></div><?php

 

$AnswerQuery = mysql_query("SELECT * FROM ArtisanAnswer WHERE ART_ID = '".$ART_ID."' ORDER BY ARQ_ID ");

?>

<table align = "right" width = "35%"  border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;">

<?php

while ($row = mysql_fetch_array($AnswerQuery))

{

$Ans = $row["ARAN_Answer"];

?>

<tr>

<td align="left" height="50px"><?php echo $Ans; ?> </td>

</tr>

<?php

}

?></table><?php

}

}

}

 

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.