Jump to content

dannyb785

Members
  • Posts

    544
  • Joined

  • Last visited

Everything posted by dannyb785

  1. Change the curly braces where you have '{$_FILES['Uploadfile']['Name']}'. Not sure if that's causing the problem, but a cleaner way to do that is: $uploadedfile_name = $_FILES['Uploadfile']['Name']; $sql= "INSERT INTO procedures (Name, Procedure_number, Created_by, Uploadedfile) VALUES ('$_POST[Name]', '$_POST[Procedure_number]', '$_POST[Created_by]', '$uploadedfile_name')"; that should solve your problem
  2. To address the comment about it giving the error just saying "Error:", obviously it's not a mysql error, otherwise it would say something after "Error:", what it looks like the problem is, is that the "move_uploaded_file" is failing, probably because your $targetx is incorrect. I would suggest changing your else statement to say else { //Gives and error if its not die('Error: target='.$targetx.', tmp_name='.$_FILES['Uploadfile']['tmp_name']); } This way you can see exactly what file is attempting to be moved to what folder
  3. maybe I'm missing something, why hasn't str_replace been used? Seems to me thatd be the easiest. Are you trying to convert strings to url-friendly? Or are you trying to find all instances of "XX oz bottle" to convert? If that's the case, a simple str_replace(" oz bottle", "-oz-bottle", $string) is all you'd need.
  4. You're saying it like you may not have control over the size of the image. If you provide php before any image is displayed, you can always set the max height/width When I do image resize scripts, I always check that the height is less than 600 pixels(to fit in most browsers) and to specify the image width/height, I do the following: // code that gets the current image's width/height and puts into $image_width/$image_height if($image_height > 600) { $r = $image_h / 600; // $r is temporary variable that represents the ratio between the image height and 600 $image_width = $image_width / $r; // that ratio is applied to the width $image_height = $image_height / $r; // and then apply the ratio to the height } // so now $image_width/$image_height are set so that the dimensions are proportional to the original, and so that the height is no greater than 600 modify this code accordingly to fit your needs
  5. There's the easy, but more resource-consuming way: make a php script that grabs every row from the table, do a while($row = mysql_fetch_assoc($result)) and in each iteration, do the preg_replace for the specified variable and then do a mysql UPDATE to modify that row I know there's a way to do the search/replace using mysql(provided the $find2 in question is the same for every record) using a find/replace query, but I don't know mysql well enough to be able to help you with that
  6. Javascript is like css, while it is certainly different from html, both are useless without html. You can have html without javascript but you can't have javascript without html. Javascript helps html be more useful, but html can work by itself.
  7. Not sure if you're familiar with the "headers already sent" error but 99% of the time, you get the error when you've output html to the page(even a space or line break is enough) and then attempt to set headers. Find the part where the headers are sent and I almost guarantee you that before that point, you've output something onto the page
  8. I would change the ajax function to ("POST", "process.php") and my process.php page would be the page that processes each input(as a $_POST variable), insert into the database or whatever, and then make the appropriate echo statement(which ajax would spit back out to the page) based on the values that were processed. Personally, I never use GET for forms. Not that POST is really MORE safe, but it helps me visualize things better and the average user can't play around with variables as easily(still can, just not as easily)
  9. Have you tried sending it without specifying the headers as html? When my header is basic like "From [email protected]", usually just pasting the url is enough because then the email client(gmail, hotmail, etc) will convert it into a hyperlink automatically. Also, have you tried taking out the "<html><body>" of the email? I feel like that part might clash with the email client's <html> and <body> tags which it has in the beginning of its html code. But your note "but there is simply no link, whereas there is a link when using Gmail." makes me think that if the client has detected the email as spam, that would be one reason why it stripped the html. Or as stated above, there are probably settings in outlook/etc where you can specify how html is treated based on the address it arrives from
  10. IMO, you shouldnt have a script(js or php) that automatically collects all fields' input because a simple hacker could just insert their own input fields(like <input type=text name=whatever value='<script>blah blah</script>'>) and potentially mess things up. Personally, I always collect each field individually and set their own individual variables, run them through their proper filters, and then spit the ajax info back. Sorry if that's not what you were asking; if it wasn't please let me know
  11. Do you mean converting the text that you find into a link? You already have the right idea with your idea converting it into bold, except you would just do <?php $find ="/$word/i"; $replace ="<a href='page.php'>$word</a>"; Echo preg_replace ($find, $replace, $definition); ?> or do go a bit further, perhaps you want the text to be converted into a clickable link that goes to a page that searches for that term? <?php $find ="/$word/i"; $replace ="<a href='search.php?search=$word'>$word</a>"; Echo preg_replace ($find, $replace, $definition); ?> is that what you meant?
  12. Hello all! I used to frequent these boards a few years ago and stopped for whatever reason, but lately I've been needing help and also want to impart my own knowledge on newbies so it's good to be back!
×
×
  • 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.