Jump to content

ofmyst

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ofmyst's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have tried to make this work, but with parents, children, their children, etc., and starting from first generalation having seven children, it is becoming very unwieldy from an organizational standpoint and tracking who goes with who in the mysql. Is there perhaps another way of approaching this that keeps the families "together" in the database?
  2. I'm sorry it was a week. Life threw some curve balls my way! Okay, I think I get the gist of it. I'm very new to mysql and php so it usually takes me alot of trial and error, but mostly help from the kindness of others. Thank you.
  3. I am sorry, but I don't exactly understand how the database table structure would work to accomodate the next generations. How would the fields be constructed? Thank you!
  4. Now that I have a very basic understanding of mysql and php I would like to use it for my website that contains my famiily tree. Each page is a branch of the tree - the parents and their children. When you click on one of the children they become the parents and their children are listed. This goes on down the line. It is very unwieldly right now, as I manually write each page and every change has to be reflected in the next generation page. Is there a good way to structure mysql to make this function efficiently? Right now we go as far as five generations. My instinct is to have a table within a table but I do not know if this can be done. And if so if it is the most efficient way to handle the task at hand. Any help will be very much appreciated.
  5. Ah, I just saw myself I lost my echo line. It works great. Thank you so much!
  6. Thank you so much for answering. Okay, that helped me alot with the concept and my links are working just fine now. However, my view.php page is still blank. When I do a view source it is empty (other than the html & body, etc tags). The address is correct at the top. Any thoughts? View.php code is: <?php $con = mysql_connect(""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("paintings", $con); $result = mysql_query("SELECT * FROM tinkers WHERE id='".$_GET['id']."'") or die(mysql_error()); while($row = mysql_fetch_array($result)) { $row['Title'] . "<br>\n". $row['Medium'] . "<br>\n". $row['Size'] . "<br>\n"; } mysql_close($con); ?> My main page if it helps is: www.sharondross.com/images/tinker/tinker.php
  7. I asked previously but the problem was not resolved, mainly I think because I could not understand the concept well enough to follow the logic. Here is what I am trying to do. Perhaps if I can understand the logic of the commands I will be able to get it right. I have a mysql database (called paintings) and a table within (called tinkers) with an inventory of paintings. In the fileds are ID (1 - , [id] the address for the JPG [image tn], the link to the file that give more information and a larger version of the image [link], the address for the larger image [image], the title [title], medium[medium] and size . The file that calls up the database to show the array of paintings is tinker.php. This page works fine. If the viewer would like to see an enlargement with further information the link is called view.php. This is where my problem comes. I cannot get the link to pull the information for that particular painting into the new page. I believe the link would be view.php?id=1, etc. but do I put the link in as <a href="view.php"> and the rest pulls itself, or do I put it in as <a href="view.php?id=1">. Also, when I put in the code: mysql_select_db("paintings", $con); $id = (int) $_GET['id']; $result = mysql_query("SELECT * FROM tinkers WHERE id=$id"); The WHERE part yields a blank page for me. Also, in addition to getting the coding right for the tinker.php page I am not sure what instructions are put in the view.php page. Perhaps if I could have a simple example or a brief explanation of the concept it will help me move forward. Thank you very much!
  8. I'm sorry I didn't get back last night with more specific information. I was too sleepy! I played around and it seems what makes the paintngs disappear is: WHERE id=$id - from the line - $result = mysql_query("SELECT * FROM tinkers WHERE id=$id"); line. When it is just $result = mysql_query("SELECT * FROM tinkers"); the paintings show up. Also [/url] does not work but </url> does. However, I do not know if that is an appropriate exchange. Is it okay to close <a href=" "> with </url> rather than </a> or does the opening have to be something else? I really do appreciate all of the help.
  9. No errors, but still no paintings. See working page: http://www.sharondross.com/images/tinker/tinker2.php .
  10. I tried that code and lost everything in the echos. Also am I using [/url] or </url> and if I use that do I replace <a href=" with <url=" ? Thank you again.
  11. I'm so embarassed but I have read through the notes many times and played around, but cannot quite get it. My paintings page, (if it helps you can find it at: http://www.sharondross.com/images/tinker/tinker.php). When the painting is clicked on I want it to click to a page that autofills. An example of a non-autofill but the structure I would like to have is: http://www.sharondross.com/images/tinker/207.html. I am trying to set up the PHP. The PHP I have for the main page - tinker.php - is: " <table width=100%> <tr> <?php $con = mysql_connect(""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("paintings", $con); $result = mysql_query("SELECT * FROM tinkers"); // initiate counter $i = 2; while($row = mysql_fetch_array($result)) { echo '<td align="center" style="color:white; font-family:Garamond; font-size:20px" ><br> <a href='. $row['Link'] . "><img src=\n". $row['Image TN'] . " border=0 class=borderimage onMouseover=borderit(this,'black') onMouseout=borderit(this,'white')></a> <br><br><a href=\n". $row['Link'] .">\n". $row['Title'] . "</a><br>\n". $row['Medium'] . "<br>\n". $row['Size'] . "<br><br><br><br></td>\n"; // if $i is equal to , echo a new table row if($i == 2 ) { echo "</tr><tr> "; } // if $i is equal less than 3, echo a new table row then end 2 ptg table elseif($i == 3 ) { echo '</tr> </table> </td> </tr> <tr> <td colspan=4>'; echo ' <table width=100%><tr><td> </td> </tr> <tr>'; } // if $i is dividable by 3, echo a new table row elseif($i%3 == 0) { echo '</tr>'; echo '<tr><td colspan=3><img src="/images/misc/blankline.gif" width=925></td></tr>'; echo '<tr>'; } // increment counter $i++; } echo '</tr> </table>'; mysql_close($con); ?> </td></tr></table> " I don't exactly get where the GET and the WHERE go. I am sorry to even ask again, I know it is annoying, but to hand fill in each of these pages it such a pain, and I would love to have it pull the information. Thank you .
  12. Well, even better. Now I know why I could not make heads or tails of things - I was missing the concept. Let me re-read all of the notes and see if I can't figure it out. I imagine I will be back. Thanks again.
  13. I am making a mud pie of this (and I thought this would be the easy part ::: smile : What I think I am trying to say is - look for the id2 only and echo the info in id2's fields. (I will make duplicate .php pages for id3, id4 etc.). Here is the code I have now. I know you have answered this already, and I appreciate your patience, but apparently I am incapable of understanding the answer! I pared it down to make it easier - I hope. -------------------------- <?php $con = mysql_connect(""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("paintings", $con); $result = mysql_query("SELECT * FROM tinkers WHERE $id = '$2' "); if(mysql_num_rows($result) == 0) echo "no painting found"; else { extract($row); // all row variables are now ready to be processed } mysql_close($con); ?> ------------------------------ When I run it like this I get no painting found, but I do have an id2 entry in the mysql.
  14. I think I followed your directions - I now have a field called id,set to int, auto-increment, primary. It automatically numbers 1, 2, etc.. paintings is the database, tinkers is the table. I made the following changes: <table width=100%> <tr> <?php $con = mysql_connect(""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("paintings", $con); $result = mysql_query("SELECT * FROM tinkers WHERE id='$1' "); if(mysql_num_rows($result) == 0) echo "no painting found"; else { echo '<td align="center" style="color:black; font-family:Garamond; font-size:20px" ><br>'. $row['Image'] . "<br><br>\n". $row['Link'] . "<br>\n". $row['Title'] . "<br>\n". $row['Medium'] . "<br>\n". $row['Size'] . "<br>\n "; mysql_close($con); ?> <font size=1>© S.D. ROSS </font><br><BR> <font size=3><B>All Rights Reserved</b><BR><BR> </td> </tr> </table> I end up with a blank page. I think I have misunderstood what do do in the WHERE part but I am not sure what?
  15. I am sorry but I am truly a novice and I wasn't able to follow what you were saying.
×
×
  • 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.