Jump to content

noclist

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by noclist

  1. Update: Finally figured it out. Had to remove the 'movieThumbs/" when assigning the default image. Thanks to everyone who helped, mark it solved.
  2. Here is what echoes for thumbNail: When I choose a thumbnail image to upload: [thumbNail] => Array ( [name] => x.gif [type] => image/gif [tmp_name] => /var/tmp/phpXylX84 [error] => 0 => 6577 ) When I leave the thumbnail field blank: [thumbNail] => Array ( [name] => [type] => [tmp_name] => [error] => 4 => 0 ) error 4 being no file uploaded, which is what I should see. I feel like I'm doing everything right except perhaps else { $thumbNail="movieThumbs/noimage.gif"; } Is that the correct way to assign the default image to that variable given my error 4?
  3. Using this method... if($_FILES['userfile']['error']==0) { // process } else { // handle the error } if($_FILES['thumbNail']['error']==0) { $thumbNail = $_FILES['thumbNail']['name']; } else { $thumbNail="movieThumbs/noimage.gif"; } Still having the same issue. I must be doing something fundamentally wrong.
  4. How do I go about testing for that error? I tried this with no luck: if ($_FILES['thumbNail']['error'] == 0) { $thumbNail = $_FILES['thumbNail']['name']; } else { $thumbNail="movieThumbs/noimage.gif";
  5. Okay, looks like it is verifying correctly, but I'm still having trouble assigning the default image. It turns out the folder I was uploading to is called movieThumbs, not thumbNail... if (isset($_FILES['thumbNail']['name'])) { $thumbNail = $_FILES['thumbNail']['name']; } else { $thumbNail="movieThumbs/noimage.gif"; } Leaving the thumbnail field blank still results in a broken image linking to just the movieThumbs/ directory.
  6. if (!isset($_FILES['thumbNail']['name'])) { $thumbNail="thumbNail/noimage.gif"; } Is something like that how I would check if there is a value already? Then obviously I'm trying to assign noimage.gif if there is no value.
  7. How do I determine if $_FILES['thumbNail']['name'] is blank? I am uploading images into a folder on my server called thumbNail and I would like to specify a default image (noimage.gif) if no prior image has been uploaded, but I'm having trouble getting an if statement to register true if the image upload was skipped. Thank you.
  8. I have a value in one table referenced in another table by foreign key and I'm having trouble wrapping my brain around how to write my insert statement. My table is called Years and each year is represented by a yID, which I then reference in my main table named Titles. I have a user interface inserting records in the database where I would like a year submitted which can assign the correct yiD to it's respective record in table Titles. Could someone explain how I would set this up in an insert statement without having to manually code in each year value and assigning them to php variables?
  9. That did the trick, thanks so much.
  10. I'm trying to upload images to my server using the $_FILES array but having issues. Here is the upload section from my form: Cover Art:<input name="coverArt" type="file" /> and my upload script I'm working with: $targetFile="coverart/" . $_FILES['coverArt']['name']; if (file_exists($targetFile)) { echo $targetFile . "<br />"; } if (move_uploaded_file($_FILES['coverArt']['tmp_name'], $targetFile)) { echo "Cover art success"; } else { echo "COVER ART ERROR"; } I'm trying to upload these images to a folder on my server called coverart, however file_exists always seems to be true no matter what and echoing $targetFile only shows my folder name "coverart/" without the filename. So of course move_uploaded_file isn't working either. Any suggestions?
  11. Thanks for the advice, I got it worked out.
  12. Would someone be able to tell me why I can't run a successful mysql_query($sql) with $sql="INSERT INTO myDB.Titles (Title, Year, cID) values('". $title . "', '" . $year . "', '" . $cID . "')"; $sql echoes out to "INSERT INTO myDB.Titles (Title, Year, cID) values('Test', '2000', '2')" It looks right but I'm probably off on the quotes somewhere. Thanks in advance.
  13. Cool that worked, not sure why I couldn't get the function to pop up though. Thanks for the help.
  14. I actually tried that earlier and it does the same thing and the statusbar shows "javascript:checkDelete(100, " without the title or closing parenthesis.
  15. I'm trying to have a javascript confirm box pop up and confirm the intention to delete a record in a database. I think I'm having trouble calling the function within my PHP code, but not sure what exactly is wrong. The status bar shows something like "javascript:checkDelete(100, Title)" when I hover over the link and that seems right but nothing occurs when I click on it. Here is my code: Javascript <script language="Javascript"> function checkDelete(b,Title){ var del=confirm("Are you sure you want to delete " + Title + " from the Database?"); if (del){ document.location="delete.php?mID=" + b + "&Title=" + Title; } } </script> PHP echo "<td><a href='Javascript:checkDelete(" . $row['mID'] . "," . $row['Title'] . ")'>"; echo "<img border=0 src='images/delete.gif'>" . "</a></td></tr>"; Anyone see my error?
  16. Thanks so much, I got it worked out.
  17. I am building a user interface to manipulate a database I have in mySQL and one of the functions is deleting records from a table I call Titles. Given my primary key is mID and a column in the table is Title, here is the code I'm working with: $sql="delete from myDb.Titles where mID=" . $_GET['mID']; if (mysql_query($sql)) { $target="delete.php?"; } echo "Successfully deleted title: " . $_GET['Title']; The actual delete itself is working fine and the record deletes properly. What I am trying to do is display the Title field associated with the record being deleted and it's not working. I don't know if I am misusing the GET function or not, but that's where I am. Any help would be appreciated.
  18. Got it, thanks so much for the help.
  19. Hi, newbie here. Could someone show me how to properly escape the quotes in this code so it works properly? I'm having major problems with it, thanks. echo "<td style="background-color:#fff" onMouseover="this.style.backgroundColor='#ff9900';" onMouseout="this.style.backgroundColor='#fff';">"
×
×
  • 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.