Jump to content

TennesseeGuy

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by TennesseeGuy

  1. Is it possible to query your results, list them in ascending order but excluding one from the ascending order that neds to be added to the end? ie ordered after query: A,B,C,D,E,G,H,I,J,K,F
  2. Thanks wick. The global vaiable worked perfectly. I was trying th return before but it wasn't working until I made it global. Thanks for your help :)
  3. Simple question for you gods of mysql. I have a simple upload include script within one of my pages. the include script is only called upon if certain criteria are met. If those criteria are met then the script process normally. The images are uploaded to the appropriate folder and the original is trashed from the temp folder. My question is how on the parent page can I extract the new file name (upload script has a unique renaming script) so I may include it in my insert into statement? Thanks all :)
  4. I got the following to work but I don't think it is still randomizing my selection but rather just repeating the original results. Any help anyone?!? Thanks again. mysql_select_db($database_myconn, $myconn); $maxImages = 8 ; $query_images = mysql_query ("select title, url, sponPic from pages where mid = '1' and active = 'Yes' and sponPic is not null ORDER BY RAND() LIMIT $maxImages"); $countImages = 1 ; while ($row = mysql_fetch_array($query_images)) { while ($countImages <= 8) { echo "<a href=\"" . $row["url"] . "\"><img src=\"" . $row["sponPic"] . "\" border=0 alt=\"" . $row["title"] . "\"></a>"; $countImages++; } }
  5. I think I got it to work....well sorta....what I would like it to do is if there is less then the defined number available in the db then to repeat existing random images until all 8 are displayed on screen. Is this possible? Here is what I have so far that doesn't error out: mysql_select_db($database_myconn, $myconn); $maxImages = 8 ; $query_images = mysql_query ("select title, url, sponPic from pages where mid = '1' and active = 'Yes' and sponPic is not null ORDER BY RAND() LIMIT $maxImages"); while ($row = mysql_fetch_array($query_images)) { echo "<a href=\"" . $row["url"] . "\"><img src=\"" . $row["sponPic"] . "\" border=0 alt=\"" . $row["title"] . "\"></a>"; }
  6. I get the following error when I attempt that solution: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in Still very much learning here so thank you very much for your assistance. Here is a slighly modified version of what I think should fit my needs...let me know if I did anything wrong with it. Thanks again. [code] mysql_select_db($database_myconn, $myconn); $query_images = mysql_query("SELECT title, url, sponBanner FROM pages where mid = '1' and active = 'Yes' LIMIT 8 ORDER BY RAND()"); $titles = array(); $urls = array(); $images = array(); while ($x = mysql_fetch_array($query_images))   $titles[] = $x['title'];   $urls[] = $x['urls'];   $images[] = $x['images']; [/code] And I believe I would use it throughout the page like this: [code] <a href="<?php $url[0] ?>"><img src="<?php $images[0] ?>" style="float: left; display: inline; width: 139px; height: 51px; margin: 0; padding:0;" alt="<?php $title[0] ?>" /></a> [/code]
  7. I have a small function I am attempting using to call upon the random image nad matching url but so far it has been unsuccessful. Could someone take a quick look at the code and perhaps see if you might be able to see the error?!? Thanks. [code] function displayImage($bannerImage,$myconn) {     $sql = "Select COUNT(*) as id from pages where mid = '1' AND sponPic is not 'NULL'";     $results = mysql_query($sql,$myconn) or die(mysql_error());     $settings = mysql_fetch_array($results);     $rowcount = $settings['id'];     // Get Any number of Random Ads Quickly     for( $AdCount = 1; $AdCount <= 8; $AdCount++ ) {         // Guess a Random Row Number         $GetRandRow = rand(1,$rowcount);         // Build the Select Query to get the wanted random row         // Being done in PHP instead of MySql because you         // can't use MySql @UserVariables in the order by clause         $query_bannerImage = "SELECT sponBanner,url,title FROM pages WHERE banner_category='$bannerImage' Limit $GetRandRow, 1";         // Fetch the Row         $results = mysql_query($query_bannerImage) or die(mysql_error());         $row_bannerImage = mysql_fetch_array($results)     } } [/code]
  8. I am hoping to find someone to hep me out with this slight issue. I have dedicated css blocks throughout a page to hold random thumbnails from member submitted images. Essientially I would like to extract the image path from a mysql database and display the image and the image url into an array of 8 and then use that array of 8 randomly in 8 different spots on a page. Is this possible?
  9. [!--quoteo(post=356105:date=Mar 17 2006, 10:54 PM:name=dromorkid)--][div class=\'quotetop\']QUOTE(dromorkid @ Mar 17 2006, 10:54 PM) [snapback]356105[/snapback][/div][div class=\'quotemain\'][!--quotec--] $review_image_root = getenv('DOCUMENT_ROOT') . '/' . getenv('REVIEW_IMAGE_ROOT'); $product_image_root = getenv('DOCUMENT_ROOT') . '/' . getenv('PRODUCT_IMAGE_ROOT'); error_reporting(E_ALL); [/quote] If the script is procesing fine and you have ran die scripts throughout the script to see what is not functioning then it has to do with your above directories...plus I didn't see a tmp directory defined. Something like below may help you out but a lot of what I have learned has been trial and error :) Just play around with a bit and you'll get it. Run a search on php.net because you may find some examples in the manual. Wish I could help more but I'm just a nOOb :) $product_image_root = $_SERVER['DOCUMENT_ROOT'].'/Images/';
  10. [!--quoteo(post=356035:date=Mar 17 2006, 05:26 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 17 2006, 05:26 PM) [snapback]356035[/snapback][/div][div class=\'quotemain\'][!--quotec--]Probably.[/quote] I am going through these pains as we speak. If there is anything I can assist you with there is no PROBABLY. I swear it makes no sense why folks think because they are smarter then the average bear they gotta skip the average bear.....but then again I rekkon thats why I'll never find myself on The Geek and the Beauty.....heh almost forgot...I had this same problem and I figured it out via lots of searching..... it had to do with my upload directory....I used the following.....takin out my stuff but you can add yours accordingly.... $(your diretory word goes here)= $_SERVER['DOCUMENT_ROOT'].'/usr/your server info'; If anyone has a better suggestion then hopefully it'll be better then PROBABLY
  11. Am getting really close now....the script pocesses as desired with my condtionals but has one bug in it. Have tried the following to work out the bug but that didn't work. My goal is too not process the upload script if there was no image uploaded (i.e. the end user never clicked browse select image). The bug is the script ptocesses regardless is an image was supplied or not which cause errors in the uplaod script if no script was ever uploaded. Thanks for all your help :) Any ideas? if ((isset($_FILES['sponsorAd'])) && ($_POST['linkType'] == 'sponsor')) { $size = array($_FILES['sponsorAd']['size']); if (sizeof($size) > 0) { include('include/uploadSponsor.php'); } }
  12. I just tried another idea and it too failed. I thought I would add a die script but the form still processed and skipped this step entirely: [code] if (isset($_POST) || isset($_FILES)) {     echo $_POST['sometext'] . "<br />";     if ($_FILES['file1']['size'] > 0) {         echo "file name: " . $_FILES['file1']['name'] . "<br />";         echo "file size: " . $_FILES['file1']['size'] . "<br />";         echo "file type: " . $_FILES['file1']['type'] . "<br />";     } } else {     $_POST[die]; }[/code]
  13. It still didn't do anything. Didn't echo anything.....just submitted the file as if it were complete :( Ughhhhhh I have been pullin my greys out just trying to get to a point where I can actually test the script....it keeps gettin skipped :( I also ran a php.ini test just to see if I could see anything wrong but it looks like everything is good to go: display_errors = 1 register_globals = 1 post_max_size = 55M post_max_size+1 = 56 post_max_size in bytes = 57671680 I also ran a gd dump and this is what I got: array(11) { ["GD Version"]=> string(27) "bundled (2.0.28 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["T1Lib Support"]=> bool(false) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XBM Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) }
  14. The only reason I am using POST rather then FILES is because the existing developed form is already using this particular structure. Should using post to call the actual PhP file void this action? The oinly reason I ask is because I even attempted using a call action if an upload occured for the simplest of scripts and it never processed either: [code] TEST.PHP <?php var_dump(gd_info()); ?> [/code]
  15. I have spent about half a day reading through the php manual regarding file upload and enhaned upload features. Have tried to put together a script, use an already developed script, play around with multiple scripts, and still no success. I do not get any errors but nothing gets uploaded. I am thinking that it has something to do with the way the form is being handled and not the actual script itself. Can anyone have a look and let me know what I am doing wrong here?!? thanks. [code] HTML: <form method="post" id="form1" action="<?php echo $editFormAction; ?>" onsubmit="return check_form(form1);"> <div id="sponsorDiv" class="pgPictureDiv"> <div class="leftColFloat">Test Upload</div> <div class="rightColFloat"> <input name="file" type="file" value="<?php if ($_POST['file']) echo $_POST['file'];?>" /> </div> <input type="submit" onclick="MM_validateForm('url','','R','title','','R','keywords','','R','description','','R','linkType','','R','email','','RisEmail');return document.MM_returnValue"  value="Submit" /> PHP: $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) {   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if (($_POST['url'] != '') && ($_POST['url'] != 'http://')) { if ($_POST['file'] != '') {             include('include/uploadSponsor.php');         }     } } [/code] Essientially what I am gathering from the form it processes quite a variety of fields and if validates moves onthroughout the field. I through this validation piece outside an else so it will atleast always check to see if it is valid. I am attempting to ECHO the file name as the value of the upload and validating that if the value is not null then run my upload script. I am guessing this script is never being ran because I attempted to upload a rather large file and it processed instantaneously. Any ideas anyone? Thanks :)
  16. [!--quoteo(post=355191:date=Mar 14 2006, 09:37 PM:name=G F D)--][div class=\'quotetop\']QUOTE(G F D @ Mar 14 2006, 09:37 PM) [snapback]355191[/snapback][/div][div class=\'quotemain\'][!--quotec--] [a href=\"http://www.tizag.com/phpT/fileupload.php\" target=\"_blank\"]http://www.tizag.com/phpT/fileupload.php[/a] [/quote] Nice small toot but doesn't exactly assist with my exact needs but a good beginner tut for learning about file upload :) [!--quoteo(post=355183:date=Mar 14 2006, 09:16 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 14 2006, 09:16 PM) [snapback]355183[/snapback][/div][div class=\'quotemain\'][!--quotec--] The php manual has a pretty indepth look at handling file uploads. [a href=\"http://us3.php.net/manual/en/features.file-upload.php\" target=\"_blank\"]http://us3.php.net/manual/en/features.file-upload.php[/a] [/quote] From a quick 5 minute glance this small thread has everything I could ever need to know about writing my own version of file upload so I rekkon I'll spend a few hours reading through this thread and doing some trial and error practice ;) While I am playing with my new little script does anyone know if you can implement a file upload script to an existing form? From a quick glance it appears that the upload scripts are standalone applications but I would like it to play a part of a whole script. When the user submits the form (upload included) all other parts of the form has handled the way they currently are and the only thing that changes is the part regarding the actual uploaded file. Or do you need to upload the file for preview and then redirect back to the original page with the previewed image so the user may continue completion of the form? Thanks for your help....back a reading I a go :)
  17. Thanks you two. Will read up on both links tomorrow. Time to take my old bones to bed so I can give my old brain a break before dig into some php readings :) Look forward to learning something new tomorrow :) Thanks again!
  18. Does anyone know of any easy to use upload scripts that allow for two things: 1) Limiting the file size. 2) Limiting the dimensions? I am hoping to integrate an upload feature to a current PhP script I am using but none exists for that particular script so am Googlin as we speak in search of a nice little upload script :)Thanks.
  19. Am looking for a fairly simple script I can use to implement a calendar into a webste. I am looking for a xhtml compliant and slimmed down calendar. i don't wanna get those robust calendars when all I need to be able to display is content for particular events. Content being title of event. Do not need it to have end user input....perhaps some kind of simple txt file I can use and ftp it onto the server and the PhP file can pull the content from the txt file? I just don't have a lot of bandwidth to spare and am trying to avoid those larger applications like Active Calendar. Any ideas guys/gals? Thanks for your recommendations and help :)
×
×
  • 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.