Jump to content

ipPHPadmin

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ipPHPadmin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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 } } } ?>
  2. <? ++++Connecting to the database++++ $query = mysql_query("SELECT MAX(ART_ID) AS maxAID FROM Artisan"); while(mysql_fetch_array($query)) { $maxAID = $row["maxAID"]; for($artID = 1; $artID <= $maxAID; $artID++) { $Aquery = mysql_query("SELECT * FROM Artisan WHERE ART_ID = '$artID'"); ?> <table align = "center" width="90%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <?php while($row = mysql_fetch_array($Aquery)) { $ART_Name = $row["ART_Name"]; ?> <tr> <td><?php echo $ART_Name; ?></td> <td> Filler </td> </tr> <?php }?></table><?php $Qquery = mysql_query("SELECT * FROM ArtisanQuestion ORDER BY ARQ_ID"); ?> <table align = "left" width="35%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <?php while($row = mysql_fetch_array($Qquery)) { $Ques_ID = $row["ARQ_ID"]; $Ques = $row["ARQ_Question"]; ?> <tr> <td><?php echo "<b>".$Ques_ID."</b>. ".$Ques; ?></td> </tr> <?php }?></table><?php $Aquery = mysql_query("SELECT * FROM ArtisanAnswer WHERE ART_ID = '$artID' 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($Aquery)) { $Ans = $row["ARAN_Answer"]; ?> <tr> <td><?php echo $Ans; ?></td> </tr> <?php }?></table><?php } } ?>
  3. 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---- }
  4. Alright, so I tried all of the above suggestions and I'm still not getting anything to display.
  5. I think all of my php is closed. I have a lot of <?php and ?> because of using html and tables in the middle of the page to display the php in a somewhat formatted manner. I might be misunderstanding what you're saying though. I tried echoing data at the beginning of the code and it stops working once inside the for loop, but works everywhere before it.
  6. Hello everyone, I'm trying to create a page that takes information from an existing database and displays it in a 'table' on a page. The table thing didn't seem to be working with some other pages I was working on so I split each database table into its own html table and rearrange accordingly. The code below doesn't output any information and I can't figure out why. Thanks in advance. $query = mysql_query("SELECT MAX(ART_ID) AS maxAID FROM Artisan"); while(mysql_fetch_array($query)) { $maxAID = $row["maxAID"]; for($artID = 1; $artID <= $maxAID; $artID++) { $Aquery = mysql_query("SELECT * FROM Artisan WHERE ART_ID = '$artID'"); ?> <table align = "center" width="90%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <?php while(mysql_fetch_array($Aquery)) { $ART_Name = $row["ART_Name"]; ?> <tr> <td><?php echo $ART_Name; ?></td> <td> Filler </td> </tr> <?php }?></table><?php $Qquery = mysql_query("SELECT * FROM ArtisanQuestion ORDER BY ARQ_ID"); ?> <table align = "left" width="35%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <?php while(mysql_fetch_array($Qquery)) { $Ques_ID = $row["ARQ_ID"]; $Ques = $row["ARQ_Question"]; ?> <tr> <td><?php echo "<b>".$Ques_ID."</b>. ".$Ques; ?></td> </tr> <?php }?></table><?php $Aquery = mysql_query("SELECT * ArtisanAnswer WHERE ART_ID = '$artID' ORDER BY ARQ_ID"); ?><table align = "right" width="35%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <?php while(mysql_fetch_array($Aquery)) { $Ans = $row["ARAN_Answer"]; ?> <tr> <td><?php echo $Ans; ?></td> </tr> <?php }?></table><?php } } ?>
  7. Alright, first off, thanks for the timely responses devilinc. As for your questions, I am trying to insert just the "1" part and the data type of the database field is correct. I tried what you said in your most recent post and it worked! Do you have any idea why removing the " and . would make it work correctly? Thanks again for the help.
  8. Hello all, I can't get the data store in the $ART_ID variable to pass into the database. The original $Artisan variable is set up like this: 1. Artisan Name. So the explode is taking just the number. If I put an echo after the explode and the $ART_ID variable it outputs the correct information but it doesn't store in the database as that data. The query is in correct order too. Thanks in advance. $CType_Type = $_REQUEST["CTYPE_Type"]; $Artisan = $_REQUEST['Artisan']; $Quantity = $_POST['Quantity']; $HAnswer1 = $_POST["HAnswer1"]; $HAnswer2 = $_POST["HAnswer2"]; $HAnswer3 = $_POST["HAnswer3"]; $HAnswer4 = $_POST["HAnswer4"]; $break = explode(".", $Artisan); $ART_ID = $break[0]; if(!$Quantity) { die('Quantity field is empty. Please enter the quantity of handicrafts made.'); } else { $ctypeQuery = mysql_query("SELECT CTYPE_ID FROM CraftType WHERE CTYPE_Type = '".$CType_Type."'"); while($row = mysql_fetch_array($ctypeQuery)) { $CTYPE_ID = $row["CTYPE_ID"]; $sql = ("INSERT INTO Handicraft VALUES (`HANDI_ID`, '".$Quantity."', 'NULL', '".$CTYPE_ID."', '".$ART_ID."', 'NULL', '1')"); if(!mysql_query($sql)) { die('Error inserting Handicraft Type into table: ' . mysql_error()); } else { -----data in this section doesn't affect the rest of the code---- } } }
  9. Ok, I figured it out. Both of those replies would actually work. My problem was on the page passing the ART_ID into the delete page. I didn't have the correct form surround the ART_ID on the initial page. Thanks for the help
  10. Just tried it but it's still not deleting anything.
  11. Hello everyone, I'm trying to display two tables side by side in a php file. I realize this may not be the correct forum for this, but i feel like its an html issue not php. I have the code pulling all the information correctly from the database but its not displaying in tables correctly. It's currently displaying two tables side by side but with the data in 5 columns instead of 5 rows. Thanks in advance for the help. <?php $display = mysql_query("SELECT * FROM Artisan WHERE ART_ID = '".$ART_ID."'"); $numrows = mysql_num_rows($display); if($numrows == 0) { die('Could not find artisan information: ' . mysql_error()); } else { while($row = mysql_fetch_array($display)) { $A_ID = $row["ART_ID"]; $A_Name = $row["ART_Name"]; ?> <table align = "center" width = "100%" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <tr> <td align="right">Artisan Name:</td> <td align="left"><?php echo $A_Name; ?> </td> </tr> <tr> <td align="right">Artisan ID:</td> <td align="left"><?php echo $A_ID; ?></td> </tr> </table> <?php $QuestionQuery = mysql_query("SELECT * FROM ArtisanQuestion ORDER BY ARQ_ID")or die ("Error retrieving artisan questions." . mysql_error()); while ($row = mysql_fetch_array($QuestionQuery)) { $QuesID = $row["ARQ_ID"]; $Ques = $row["ARQ_Question"]; ?> <table align = "left" width = "100px" height = "50px" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <tr> <td><?php echo $QuesID. ". ".$Ques; ?></td> </tr> </table> <?php } $AnswerQuery = mysql_query("SELECT * FROM ArtisanAnswer WHERE ART_ID = '".$A_ID."' ORDER BY ARQ_ID "); while ($row = mysql_fetch_array($AnswerQuery)) { $Ans = $row["ARAN_Answer"]; ?> <table align = "right" width = "100px" border="0" style="font-size: 12px; margin-top: 30px; font-family: Tahoma;"> <tr> <td><?php echo $Ans; ?> </td> </tr> </table> <?php } } } } ?>
  12. Hello everyone, I am attempting to delete a row from my SQL database. I'm using phpMyAdmin for my database manager. I've tried to do this two different ways (which are posted below), but each way is initiated by selecting a delete button on the previous page. I'm not getting any errors, and it is running through and displaying the "Success!" line, but not deleting anything. Thanks in advance for any help. Attempt #1: $max = mysql_query("SELECT MAX(ART_ID) AS maxAID FROM Artisan"); $numrows = mysql_num_rows($max); if($numrows == 0) { echo "Artisan was not deleted."; ?> ---some html filler that doesn't use the php above or below---- <?php } else { while (mysql_fetch_array($max)) { $ART_ID = $row['maxAID']; $deleteArtisan = mysql_query ("DELETE FROM Artisan WHERE ART_ID = '$ART_ID'"); $deleteAnswers = mysql_query ("DELETE FROM ArtisanAnswer WHERE ART_ID = '$ART_ID'"); echo "success!"; if (!$deleteArtisan || !$deleteAnswers) { die ("error: " .mysql_error()); } } } Attempt #2: $id = $_REQUEST['ART_ID']; $max = mysql_query("SELECT * FROM Artisan WHERE ART_ID = '$id'"); while(mysql_fetch_row($max)) { $deleteArtisan = mysql_query ("DELETE FROM Artisan WHERE ART_ID = '$ART_ID'"); $deleteAnswers = mysql_query ("DELETE FROM ArtisanAnswer WHERE ART_ID = '$ART_ID'"); echo "success!"; if (!$deleteArtisan || !$deleteAnswers) { die ("error: " .mysql_error()); } }
×
×
  • 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.