Jump to content

steveboj

Members
  • Posts

    21
  • Joined

  • Last visited

Everything posted by steveboj

  1. It's looking good so far, you're almost there. This line "echo '<a href="albuminfo.php?albumid=' . $row[0] . '">' . $row[1] . '</a>';" makes the 'albumid' available to albuminfo.php. So on albuminfo.php you just have to query the database to return all the data for that albumid, e.g. with a query like: $result = mysql_query("SELECT * FROM album WHERE albumid = '" . $_GET["albumid"] . "'");
  2. Yes!!! This has solved it. I had come across "SET NAMES" before, but for some reason thought you only used it when you were inserting data into a database... Thanks for taking the time to explain this – I got so excited when I realised it was working, I didn't notice my dinner was burning
  3. Thanks ChemicalBliss, using your function does make the text appear, but it also changes some of the non-standard characters to squares. I've done some testing with a different MySQL database and discovered the problem isn't actually a result of using PHP 5.2.8, e.g. The code works with PHP 5.2.8 and MySQL 5.0.51a, but it doesn't work with PHP 5.2.8 and MySQL 5.1.30 So I'm guessing it may be a character set or configuration issue with MySQL 5.1.30 - or the combination of PHP 5.2.8 and MySQL 5.1.30. Does this sound familiar to anyone else?
  4. I thought I'd finally figured out how to work with UTF-8 data and htmlentities(), until I encountered PHP 5.2.8... This code works perfectly on PHP 5.2.6, but returns an empty result on PHP 5.2.8 echo htmlentities($input_text, ENT_NOQUOTES, "UTF-8"); The $input_text comes from a MySQL database. I've done some Googling and it sounds as though this is caused by characters in the $input_text that aren't actually UTF-8. Has anyone else had this problem and found a solution?
  5. You have to do this with jQuery and AJAX - there's a good tutorial which includes a bit on loaders image here = http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-day-13/
  6. Looks like you've got into a bit of a muddle with your HTML, it seems you've included <img> tags within your links, e.g. I think this should be right: <?php do { ?> <a href="http://www.domain.com/photo_album/images/<?php echo $row_photos['photo']; ?>" rel="lightbox[roadtrip]"> <img src="http://www.domain.com/photo_album/images/small/<?php echo $row_photos['photo']; ?>" /> </a> <?php } while ($row_photos = mysql_fetch_assoc($photos)); ?> </p></div>
  7. There are pros and cons to all the different rollover methods depending on the code your working with. Your next issue will be to find a suitable way to pre-load the hover image so it displays immediately when the user hovers over the button.
  8. You really need to stop and take a few moments to make sure you understand what oni-kun has been kind enough to tell you. It simply isn't possible to style using PHP or create image rollovers using PHP. So you have posted in the wrong forum and you need to look into CSS and Javascript.
  9. You'll be really lucky to find something that does exactly what you want, e.g. do you know whether you want it to crop images to exact dimensions, or just resize the images to the longest edge. Do you know whether the initial source images will always be the same orientation and dimensions, etc. I suggest you need to work out exactly what you need the script to do, then look to create your own script using the GD functions. It'll take quite a bit of time and effort, but it'll be worth it because that's probably the only way to get an image upload/resize script that does exactly what you need. This is impossible, because a pixel is a different size depending on the monitor resolution, so a pixel is a measurement that's only relevant to monitors. It can't be translated into real physical dimensions. ...I guess it's kind of like trying to convert inches into litres
  10. You really shouldn't have all that HTML inside a PHP variable - I'm surprised it actually works! You've got two options: 1. Put all that HTML inside a text file and simply include that text file wherever you want it to appear, e.g. include("menu_file.inc"); 2. Create a new PHP file, create a function inside that file called top_nav() to contain all that HTML, then include that file at the top of your pages and use the following code to call that function wherever you want it to appear, e.g. top_nav(); If you're not already familiar with PHP functions, you should read up about them. Personally I would create a function for this, but because that code doesn't include any PHP, it would probably be simpler for you to use the text file option.
  11. That is a 'relative' path. Try using an 'absolute' path like I showed in my previous message.
  12. Since the opendir() is failing, have you checked your file path is correct? I always use an absolute path with $_SERVER["DOCUMENT_ROOT"] when using opendir(), e.g. $dir = $_SERVER["DOCUMENT_ROOT"] . "/my_folder/";
  13. Thought I should help since I contributed to making a bit of a mess of your thread... There were two main issues with your code which should have been resolved in the code below: [*]A number of the $_POST values were messed up, e.g. $_POST $name should be $_POST["name"]. [*]I think it's always a good idea to separate variables from normal text by concatenating strings, e.g. I've changed "From: $_POST[$name] < $email >" to "From: " . $_POST["name"] . "<" . $_POST["email"] . ">". This just keeps your variables separate, so they can't get confused with the normal text. I've also made a couple of other very minor changes just to make the PHP a little more compact. <?php date_default_timezone_set('America/Edmonton'); $yourEmail = "shekinteriors@yahoo.ca"; //The Email Address Form Results Will Be Sent To. Change to your email. $subject = "Online Job Requests"; //This will be displayed in your Email Subject line. Edit as needed. $body = "Name: " . $_POST["name"] . "\n"; $body .= "Email Address: " . $_POST["email"] . "\n"; $body .= "Phone: " . $_POST["phone"] . "\n"; $body .= "Job Type: " . $_POST["job_type"] . "\n"; $body .= "Job Description: " . implode(", ", $_POST["job_description"]) . "\n"; mail($yourEmail, $subject, $body, "From: " . $_POST["name"] . "<" . $_POST["email"] . ">"); $thankyousubject = "Request Submitted Successfully \n on \n " . date("n/j/Y, \a\\t g:i a T"); //This will be displayed after a submission. Edit to suit your needs. The \n represent page breaks. $thankyoumsg = "Thank you " . $_POST["name"] . " we have recieved your information. We will contact you soon."; //This will be displayed after a submission. Edit to suit your needs. ?> <html> <body style="background-color:#2c2c2c;color:#FFFFFF"> <center> <b><?php echo $thankyousubject; ?></b> <br /><br /> <?php echo $thankyoumsg; ?> <br /><br /><br /><br /> <a href="http://www.shekinteriors.com" target="_top"> <img src="http://www.shekinteriors.com/formbanner.gif" width="600" height="100" alt="Return to Shek Interiors Ltd" border="0"> </a> </center> </body> </html> Give that a go and let me know if you encounter any further problems.
  14. Doh! It's perfectly flexible. I've used this method in my own CMS for years without any problems : ) Really? Using RegEx to try and ascertain the correct fields to pull values from assumes that when there are changes to be made later (by the same or different person) that the person knows the logic for ascertaining those fields. It could happen that they want to add a field for the user to enter the number of years that they have conducted those job descriptions. That field might be created with the name "job_description_years" - which would introduce a bug. Of course, I am manufacturing a scenario that would break that code and lead to additional time needed to debug. But, the point is that it is not an efficient method and introduces much more complexity than simply making the fields an array and using a single implode() function in the processing page. OK, that is a potential problem with my quickly written example (I didn't bother including my usual regex to only match numbers after the initial "job_description_"). On it's own that doesn't make this method inflexible, but I get your point, i.e. it's better to code things properly, especially if the code could be edited by someone else in the future.
  15. Doh! It's perfectly flexible. I've used this method in my own CMS for years without any problems : )
  16. Ah, I remember experimenting with the square brackets a few years ago and found they either didn't work or were unreliable (can't remember which!) – so I've avoided them ever since. I'll have to give them another go. Thanks
  17. I did something similar to this once with a simple array and the rand() function. Alternatively you could put the your last 3 lines in an array, then use the shuffle() function and display just the first 2 lines.
  18. Yes, checkboxes are a bit of a hassle. I think your problem is with the square brackets in the checkbox names, so I would name them "job_description_1", "job_description_2", etc. Then retrieve the values with something like: foreach($_POST as $tmp_ind => $tmp_val) { if(preg_match("/^job_description_/", $tmp_ind)) $job_description .= $tmp_val . "\n"; }
  19. There doesn't appear to be a "session_start();" at the top of your script?
  20. I think I had this problem with a script I wrote a few years ago. I've just had another look at it to see if I could remember what solved it. 1. My script used: header('Content-Type: application/octet-stream'); If that doesn't help, you could try this: 2. My script first saved a copy of the file on the server. Then it used "readfile()" to output the file, and once that file had been downloaded, the copy on the server was deleted. If you want to give that a go, take a look at the manual page for readfile() because it includes a useful example = http://uk3.php.net/manual/en/function.readfile.php.
  21. I'm working on a new PHP + MySQL site which uses data from a FileMaker Pro database, and I'm hoping someone can help me understand how I should organise the character sets to properly deal with 'non-standard' characters. My client uses a FileMaker database, which they export as 'CSV' and then import into phpMyAdmin. My confusion started when I tried to convert the non-standard characters to their HTML equivalents, e.g. convert a GB Pound sign to £ or &#163; I couldn't work out how to use PHP to convert those characters when the data was being exported out of FileMaker as "Windows (ANSI)". So I tried exporting from FileMaker as "Unicode (UTF-". Exporting as UTF-8 does seem to work, but my data now appears scrambled when I view it in phpMyAdmin. So I'm wondering if I need to change the character set of the MySQL database somehow? On the phpMyAdmin home page I can see a drop-down menu of character sets for "Language", but I'm a bit scared of changing that in case it messes up any of my other databases... So my head is spinning at the moment and I'm hoping someone can help me understand what the issues are here and how I should deal with the character sets. Thanks in advance! Steve
×
×
  • 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.