Jump to content

nubble

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

About nubble

  • Birthday 10/07/1978

Profile Information

  • Gender
    Female
  • Location
    Middle of nowhere, ME

nubble's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Holy cow man - thank you so much! I just tried integrating the code you posted into my page, here's the URL. http://sprucenubblefarm.com/chondros/printable_chondro.php?critter=TI06W19 Something is funky because the images aren't displaying, but I'm not getting any errors. All the other php on the page is working fine. Not sure if I did something wrong. Here's the code for the page: <?php mysql_connect("mysql.blahblah.com", "blah", "blah123"); mysql_select_db("sprucen_chondros"); $sql = "SELECT `snakeID`, `locality`, `neonate_color`, `sex`, `description`, `birthyear`, `price` FROM `general` WHERE `snakeID` LIKE '$critter'"; $query = mysql_query($sql); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Green Tree Python For Sale</title> <link href="../print.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <?php while($row = mysql_fetch_assoc($query)){ echo '<p class="FONT_heading">'; echo $row['birthyear']; echo " "; echo $row['locality']; echo " "; echo $row['sex']; echo '<span class="FONT_idnumber"> '; echo $row['snakeID']; echo '</span>'; echo '<hr size="1" noshade color="#5B7331">'; echo '<table width="100%"><tr><td width="70%" valign="top"><p class="FONT_text1"><span class="FONT_featured-subhead">'; echo '<b>Birthyear:</b> '; echo $row['birthyear']. '<br />'; echo '<b>Locality Type:</b> '; echo $row['locality']. '<br />'; echo '<b>Sex:</b> '; echo $row['sex']. '<br />'; echo '<b>Neonate Color:</b> '; echo $row['neonate_color'].'</span><br /><br /></p></td><td valign="top" class="FONT_price"><br><b>$'; echo $row['price'].' </b> Shipping via Delta Dash Included!<br /><span class="FONT_featured-text"> CALL<b> (207)684-3539</b> TO ORDER </span></td></tr></table><p class="FONT_text1">'; echo $row['description']. '</p>'; }?> </td> </tr> <tr> <td> </td> </tr> <tr> <td> <?php isset($_GET['critter']) && $critter=$_GET['critter']; (strpos($critter,'..')) && $critter=NULL; (isset($critter) && !is_dir($critterdir="../images/chondros/$critter")) && $critter=NULL; if(empty($critter)) header("location:http://sprucenubblefarm.com/error.html"); $dh=opendir($critterdir); while($file = readdir($dh)) { if(is_file($file) && preg_match("@^.*\.(?:jpeg|jpg|gif)$@i",$file) && filesize($file)>(1024*10)) { echo "<IMG SRC=\"$critterdir/$file\"><BR>"; } } closedir($dh) ?> </td> </tr> </table> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="left" valign="top"> </td> <td align="left" valign="top"> </td> <td align="left" valign="top"> </td> </tr> <tr> <td width="50%" align="left" valign="top"><table height="30" border="0" cellpadding="0" cellspacing="0" class="tab-bar"> <tr> <td align="left" class="FONT_heading">Feeding Records</td> </tr> </table> <table class="data"> <tr> <td class="data"><b>Date</b></td> <td class="data"><b>Qty</b></td> <td class="data"><b>Prey Type</b></td> <td class="data"><b>Notes</b></td> </tr> <?php $sql = "SELECT `snakeID`, `quantity`, `type`, `notes`, `date`, DATE_FORMAT(date, '%m/%d/%Y') AS `Date of Event` FROM `feedings` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)){ echo '<tr><td class="data">'; echo $row['Date of Event']; echo '</td><td class="data">'; echo $row['quantity']; echo '</td><td class="data">'; echo $row['type']; echo '</td><td class="data">'; echo $row['notes']; echo '</td></tr>'; }?> </table> </td> <td width="25%" align="left" valign="top"><table height="30" border="0" cellpadding="0" cellspacing="0" class="tab-bar"> <tr> <td align="left" class="FONT_heading">Stool Records </td> </tr> </table> <table class="data"> <tr> <td class="data"><b>Date of Stool</b></td> </tr> <?php $sql = "SELECT `snakeID`, `date`, DATE_FORMAT(date, '%m/%d/%Y') AS `Date of Event` FROM `stools` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)){ echo '<tr><td class="data">'; echo $row['Date of Event']; echo '</td></tr>'; }?> </table></td> <td width="25%" align="left" valign="top"> <table height="30" border="0" cellpadding="0" cellspacing="0" class="tab-bar"> <tr> <td align="left" class="FONT_heading">Care Log & Notes </td> </tr> </table> <table class="data"> <tr> <td class="data"><b>Date</b></td> <td class="data"><b>Notes</b></td> </tr> <?php $sql = "SELECT `snakeID`, `notes`, `date`, DATE_FORMAT(date, '%m/%d/%Y') AS `Date of Event` FROM `carelog` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)){ echo '<tr><td class="data">'; echo $row['Date of Event']; echo '</td><td class="data">'; echo $row['notes']; echo '</td></tr>'; }?> </table></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> </tr> <tr align="left" valign="top"> <td width="50%"><table height="30" border="0" cellpadding="0" cellspacing="0" class="tab-bar"> <tr> <td align="left" class="FONT_heading">Weight Records </td> </tr> </table> <table class="data"> <tr> <td class="data"><b>Date</b></td> <td class="data"><b>Weight in grams </b></td> </tr> <?php $sql = "SELECT `snakeID`, `weight`, `date`, DATE_FORMAT(date, '%m/%d/%Y') AS `Date of Event` FROM `weights` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)){ echo '<tr><td class="data">'; echo $row['Date of Event']; echo '</td><td class="data">'; echo $row['weight']; echo '</td></tr>'; }?> </table></td> <td width="50%"><table height="30" border="0" cellpadding="0" cellspacing="0" class="tab-bar"> <tr> <td align="left" class="FONT_heading">Shedding Records </td> </tr> </table> <table class="data"> <tr> <td class="data"><b>Date of Shed</b></td> </tr> <?php $sql = "SELECT `snakeID`, `date`, DATE_FORMAT(date, '%m/%d/%Y') AS `Date of Event` FROM `sheds` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)){ echo '<tr><td class="data">'; echo $row['Date of Event']; echo '</td></tr>'; }?> </table></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </body> </html>
  2. Hi everyone, I am a wicked newbie and am having troulbe figuring out how to insert images into a php page from a certain directory. I breed snakes, each one has an id number, like TI06W19. There's a folder on the server that holds the images for each snake, e.g. /images/TI06W19 What I want to do is write a script to insert all the images in a given folder (matching the id number I enter) that are over 10K in file size. There are thumbnails of each image in the directory, and I don't want to display those (they are all under 10K and all the large images are over 10K). I want to end up with a page where I can plug the id number in on the fly, like photos.php?critter=TI06W19. Any help would be greatly appreciated. I'm in a bit over my head Thanks! Amy
  3. Friggin SAWEEET - Thank you so much. I learned a ton doing this (friggin) page -Amy
  4. Cool - thanks frost for the 411. So now I can sort by female (yay!!) - but the actual data from the "sex" field won't print. I feel like I'm in the deep end of the pool here... ??? http://sprucenubblefarm.com/chondros/filter.php?sex=female <?php $query = "SELECT `snakeID`, `locality`, LOWER(`sex`), `price`, `status`, `birthyear` FROM `general` WHERE `status` LIKE 'available'"; if(isset($_GET['price'])) { $price = (get_magic_quotes_gpc()) ? mysql_real_escape_string(stripslashes($_GET['price'])) : mysql_real_escape_string($_GET['price']); $query .= " AND price='".$price."'"; } if(isset($_GET['sex'])) { $sex = (get_magic_quotes_gpc()) ? mysql_real_escape_string(stripslashes($_GET['sex'])) : mysql_real_escape_string($_GET['sex']); $sex = strtolower($sex); $query .= " AND sex='".$sex."'"; } $result=mysql_query($query); $num=mysql_num_rows($result); $j = 0; echo "<tr>"; while($row = mysql_fetch_assoc($result)){ $j++; echo '<td width="25%"><table width="100%" cellpadding="0" cellspacing="10" class="crittergrid"><tr><td width="85" valign="top" ><a href="'; echo $row['snakeID']; echo '.php"><img src="/images/chondros/'; echo $row['snakeID']; echo '_tn.jpg" alt="Green Tree Python for Sale" width="85" height="85" border="0"></a><br><br><b>ID:</b> '; echo $row['snakeID']; echo '<br><b>Sex: </b>'; echo $row['sex']; echo '<br><b>Type: </b>'; echo $row['locality']; echo '<br><b>Price</b>: $'; echo $row['price']; echo '<br><br><a href="'; echo $row['snakeID']; echo '"><img src="/images/learn_more.jpg" width="85" height="20" border="0"></a></td></tr></table></td>'; if ($j == 4) { $j = 0; echo "</tr><tr>"; } } ?>
  5. TKS for the FYI & all the help - updated the script as suggested and it does work. I can't get ?sex=Female to work tho... Thought I'd try something out - http://sprucenubblefarm.com/chondros/filter.php?sex=Unknown and that seems to work fine... ugh. Anyone know if there is a known issue with "male" being part of the word "female" or something?? Also, I want you all to know how much you friggin rule - I'm wicked impressed One day this young Padawan hopes to learn the many Jedi PHP tricks she has seen on this board. <?php $query = "SELECT `snakeID`, `locality`, `sex`, `price`, `status`, `birthyear` FROM `general` WHERE `status` LIKE 'available'"; if(isset($_GET['price'])) { $price = (get_magic_quotes_gpc()) ? mysql_real_escape_string(stripslashes($_GET['price'])) : mysql_real_escape_string($_GET['price']); $query .= " AND price='".$price."'"; } if(isset($_GET['sex'])) { $sex = (get_magic_quotes_gpc()) ? mysql_real_escape_string(stripslashes($_GET['sex'])) : mysql_real_escape_string($_GET['sex']); $query .= " AND sex='".$sex."'"; } $result=mysql_query($query); $num=mysql_num_rows($result); $j = 0; echo "<tr>"; while($row = mysql_fetch_assoc($result)){ $j++; echo '<td width="25%"><table width="100%" cellpadding="0" cellspacing="10" class="crittergrid"><tr><td width="85" valign="top" ><a href="'; echo $row['snakeID']; echo '.php"><img src="/images/chondros/'; echo $row['snakeID']; echo '_tn.jpg" alt="Green Tree Python for Sale" width="85" height="85" border="0"></a><br><br><b>ID:</b> '; echo $row['snakeID']; echo '<br><b>Sex: </b>'; echo $row['sex']; echo '<br><b>Type: </b>'; echo $row['locality']; echo '<br><b>Price</b>: $'; echo $row['price']; echo '<br><b>Sex:</b> '; echo $row['sex']. '<br />'; echo '<br><br><a href="'; echo $row['snakeID']; echo '"><img src="/images/learn_more.jpg" width="85" height="20" border="0"></a></td></tr></table></td>'; if ($j == 4) { $j = 0; echo "</tr><tr>"; } } ?>
  6. Thanks for all the help everyone. Here's the code I ended up with. Seems to be working (yay!!!!)... but of course there is some new friggin issue This works: http://sprucenubblefarm.com/chondros/filter.php This works: http://sprucenubblefarm.com/chondros/filter.php?price=750 This works: http://sprucenubblefarm.com/chondros/filter.php?price=750&sex=Male This Doesn't: http://sprucenubblefarm.com/chondros/filter.php?sex=Female What the heck? <?php $query = "SELECT `snakeID`, `locality`, `sex`, `price`, `status`, `birthyear` FROM `general` WHERE `status` LIKE 'available'"; if(isset($_GET['price'])) $query .= " AND price='".$_GET['price']."'"; mysql_real_escape_string($_GET['price']); if(isset($_GET['sex'])) $query .= " AND sex='".$_GET['sex']."'"; mysql_real_escape_string($_GET['sex']); $result=mysql_query($query); $num=mysql_num_rows($result); $j = 0; echo "<tr>"; while($row = mysql_fetch_assoc($result)){ $j++; echo '<td width="25%"><table width="100%" cellpadding="0" cellspacing="10" class="crittergrid"><tr><td width="85" valign="top" ><a href="'; echo $row['snakeID']; echo '.php"><img src="/images/chondros/'; echo $row['snakeID']; echo '_tn.jpg" alt="Green Tree Python for Sale" width="85" height="85" border="0"></a><br><br><b>ID:</b> '; echo $row['snakeID']; echo '<br><b>Sex: </b>'; echo $row['sex']; echo '<br><b>Type: </b>'; echo $row['locality']; echo '<br><b>Price</b>: $'; echo $row['price']; echo '<br><b>Sex:</b> '; echo $row['sex']. '<br />'; echo '<br><br><a href="'; echo $row['snakeID']; echo '"><img src="/images/learn_more.jpg" width="85" height="20" border="0"></a></td></tr></table></td>'; if ($j == 4) { $j = 0; echo "</tr><tr>"; } } ?>
  7. Hey folks - I'm trying to filter a set of records by a variable that gets passed (either "sex" or "price") - e.g. filter.php?sex=female - by using the $_GET function. What I have now is not working (at all) - I get a blank page, no error codes, nothing. Can't figure out what the heck is going wrong. Would love any help! -Amy <?php $query = "SELECT `snakeID`, `locality`, `sex`, `price`, `status`, `birthyear` FROM `general` WHERE `status` LIKE 'available' and `price`=".$_GET['price']." and `sex`=."$_GET['sex'].""; $result=mysql_query($query); $num=mysql_num_rows($result); $j = 0; echo "<tr>"; while($row = mysql_fetch_assoc($result)){ $j++; echo '<td width="25%"><table width="100%" cellpadding="0" cellspacing="10" class="crittergrid"><tr><td width="85" valign="top" ><a href="'; echo $row['snakeID']; echo '.php"><img src="/images/chondros/'; echo $row['snakeID']; echo '_tn.jpg" alt="Green Tree Python for Sale" width="85" height="85" border="0"></a><br><br><b>ID:</b> '; echo $row['snakeID']; echo '<br><b>Sex: </b>'; echo $row['sex']; echo '<br><b>Type: </b>'; echo $row['locality']; echo '<br><b>Price</b>: $'; echo $row['price']; echo '<br><b>Sex:</b> '; echo $row['sex']. '<br />'; echo '<br><br><a href="'; echo $row['snakeID']; echo '"><img src="/images/learn_more.jpg" width="85" height="20" border="0"></a></td></tr></table></td>'; if ($j == 4) { $j = 0; echo "</tr><tr>"; } } ?>
  8. OK - this is proving harder to integrate than I thought. Have been fiddling with it for a while. I think it must have something to do with a quote or apostrophe out of order or something. I also tried out a test page using this select statement, which is working just fine http://sprucenubblefarm.com/chondros/filter_old.php $query = "SELECT `snakeID`, `locality`, `sex`, `price`, `status`, `birthyear` FROM `general` WHERE `status` LIKE 'available' and `price`='600' "; When I change the select statement to the one shown below, I just get a white page - no err codes or anything. http://sprucenubblefarm.com/chondros/filter.php Can anyone find the bug in this code? I'm stumped. <?php $query = "SELECT `snakeID`, `locality`, `sex`, `price`, `status`, `birthyear` FROM `general` WHERE `status` LIKE 'available' and `price`=".$_GET['price']." and `sex`=."$_GET['sex'].""; $result=mysql_query($query); $num=mysql_num_rows($result); $j = 0; echo "<tr>"; while($row = mysql_fetch_assoc($result)){ $j++; echo '<td width="25%"><table width="100%" cellpadding="0" cellspacing="10" class="crittergrid"><tr><td width="85" valign="top" ><a href="'; echo $row['snakeID']; echo '.php"><img src="/images/chondros/'; echo $row['snakeID']; echo '_tn.jpg" alt="Green Tree Python for Sale" width="85" height="85" border="0"></a><br><br><b>ID:</b> '; echo $row['snakeID']; echo '<br><b>Sex: </b>'; echo $row['sex']; echo '<br><b>Type: </b>'; echo $row['locality']; echo '<br><b>Price</b>: $'; echo $row['price']; echo '<br><b>Sex:</b> '; echo $row['sex']. '<br />'; echo '<br><br><a href="'; echo $row['snakeID']; echo '"><img src="/images/learn_more.jpg" width="85" height="20" border="0"></a></td></tr></table></td>'; if ($j == 4) { $j = 0; echo "</tr><tr>"; } } ?>
  9. You really are a super guru - holy cow man Thanks so much! -Amy
  10. Hey folks - got a new feature I want to add to a page on my site. It's a page that shows all the snakes in our database with a status of "available". I want to be able to filter the record set by price, locality and sex - e.g. available.php?sex=female - which would show only the female snakes, or available.php?price=750 - which would show only those with a price of $750. I am a wicked newbie - have no idea where to even begin. Here's what I've got now. Would appreciate any help or similar code you've used before that I can go from. Thanks! Amy <? $query = "SELECT `snakeID`, `locality`, `sex`, `price`, `status`, `birthyear` FROM `general` WHERE `status` LIKE 'available'"; $result=mysql_query($query); $num=mysql_num_rows($result); $count_to_four = 0; echo "<tr>"; while($row = mysql_fetch_assoc($result)){ $count_to_four++; echo '<td width="25%"><table width="100%" cellpadding="0" cellspacing="10" class="crittergrid"><tr><td width="85" valign="top" ><a href="'; echo $row['snakeID']; echo '.php"><img src="/images/chondros/'; echo $row['snakeID']; echo '_tn.jpg" alt="Green Tree Python for Sale" width="85" height="85" border="0"></a><br><br><b>ID:</b> '; echo $row['snakeID']; echo '<br><b>Sex: </b>'; echo $row['sex']; echo '<br><b>Type: </b>'; echo $row['locality']; echo '<br><b>Price</b>: $'; echo $row['price']; echo '<br><b>Sex:</b> '; echo $row['sex']. '<br />'; echo '<br><br><a href="'; echo $row['snakeID']; echo '"><img src="/images/learn_more.jpg" width="85" height="20" border="0"></a></td></tr></table></td>'; if ($count_to_four == 4) { $count_to_four = 0; echo "</tr><tr>"; } } ?>
  11. Obsidian - you friggin rule :)  I'm guessing you knew that tho. -Amy  ;D
  12. hey folks :)  Got a wicked newbie question.  I've got a bunch of data to display and want to sort it by date.  Now it used to work when I was echoing the date in native format: YYYY-MM-DD - but I updated the date_format recently to display as %m/%d/%Y - now the data is sorting the dates based on their alphabetical order, not by the actual order in which they occured. I'm using $sql = "SELECT `snakeID`,  `quantity`, `type`, `notes`, DATE_FORMAT(date, '%m/%d/%Y') AS `date` FROM `feedings` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC"; and here's an example page: [url=http://sprucenubblefarm.com/chondros/TI05J01_feedings.php]http://sprucenubblefarm.com/chondros/TI05J01_feedings.php[/url] so the script is grouping all the 12's together, all the 11's and so on, instead of what I'm trying to get, which is a chronological order with the newest stuff on top Can anyone help? Thanks! Amy
  13. Thank you SOOO much.  I would have been at it for days trying to figure that out.  Sweet :)
  14. Can't seem to get this bugger working.  I'm trying to display the date as M d Y - but it just keeps showing up as Y M d on my php page. I'm using $sql = "SELECT `snakeID`, `date`, `weight`, DATE_FORMAT(date, '%M %d %Y') FROM `weights` WHERE `snakeID` LIKE '$critter' ORDER BY date DESC"; and here's the page - as you can see, not working so good :( [url=http://sprucenubblefarm.com/chondros/TI05J01_weights.php]http://sprucenubblefarm.com/chondros/TI05J01_weights.php[/url] I am pretty new at this, I'm sure I'm doing something retarded. Any help would be great! Amy
  15. Thanks for your help everyone.  Got the darn thing working now! -Amy
×
×
  • 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.