Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. OK, this is a mess, but we can help you straighten it out. I'm still unclear, as you still haven't said what you're trying to achieve, can you give us an idea?  Maybe some examples of what's going to be submitted and what's being pulled by the database.  Spend a decent amount of time outlining and explaining the problem and we'll get you a solution sooner and with less posts :) Regards Huggie
  2. Ted, you're not making any sense to me I'm afraid...  What do you mean by [i]'and this is what takes the action'[/i]? The first loop looks as though it should work ok.  Perhaps you should be telling us what you're trying to achieve, rather than what you think the code should look like? Regards Huggie
  3. Gareth, This is as simple as including an if statement in your php code. [code]<?php // Check the value of the radio button if (isset($_POST['radio_button_name'])){   $r = $_POST['radio_button_name']; } // Decide what to do with it if ($r == "male"){   $sql = "INSERT INTO table_name (column_1) VALUES ('$r')"; } else {   $sql = "INSERT INTO table_name (column_2) VALUES ('$r')"; } // Run the query mysql_query($sql); ?>[/code] However, this could be a sign of bad database design, it's difficult to tell without knowing the context of the post. Regards Huggie
  4. Probably better with [code=php:0]while ($id < $int){[/code] Regards Huggie
  5. Not necessarily true... Some connect scripts actually carry out the connect itself by just including it, rather than needing to call a function within it from another script, for those that do that, a simple [i]mysql_list_tables()[/i] will get you started. Regards Huggie
  6. Try adding a few more headers.  A search on google for something like [i]php +hotmail +mail()[/i] will give you ideas as to what headers mail clients do and don't like as spam. Regards Huggie
  7. Don't worry about the 'bumping' thing, it's just one of those pet hates of mine... The forum does allow bumping and in the posting guidelines it says 'after a few hours' so no harm done.  As for the code, no problem, I like a good challenge every now and again. You could probably refine that into a single regex rather than two, but my mind really was a blank yesterday. Regards Huggie
  8. [quote author=ober link=topic=121678.msg502381#msg502381 date=1168535073] Also, the edit time will remain.  There is a lot of reasoning behind this, but the biggest is avoiding confusion within posts.[/quote] I agree this is a good idea, but just wanted confirmation as to if it was staying like this. As for the font size, it looks good now :) Regards Huggie
  9. In that case I'd go for the CURL option and use something like this: [code]<?php //Assign a new CURL instance to a handle $ch = curl_init(); // Set the options curl_setopt($ch, CURLOPT_URL, "http://www.example.com/file.htm"); // url to open curl_setopt(CURLOPT_TIMEOUT, 10); // set timeout curl_setopt(CURLOPT_HEADER, false); // don't include header output curl_setopt(CURLOPT_RETURNTRANSFER, true); // return details to a string rather than browser // grab URL and pass it into a string $file = curl_exec($ch); // close CURL resource, and free up system resources curl_close($ch); ?>[/code] Regards Huggie
  10. Sure, Try this: [code]<?php $to = "$email"; $subj = "test"; $mess = <<<HTML <html> <head>   <title>Test Mail</title> </head> <body>   This is an html email test<br />   <p><b>Your order has been processed. Please click on the link to download your purchase</b></p>   <p><a href="http://217.46.159.226/e_cart8/prompt.php">Download Your Purchase</a></p> </body> </html> HTML; $mess = wordwrap($mess,70); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; mail($to,$subj,$mess,$headers); ?>[/code] Regards Huggie
  11. You could set a timeout for the whole script... [code]<?php ini_set('max_execution_time','10'); ?>[/code] This is set to 30 by default in the php.ini file. Alternatively, if you want to set a timeout for that one command, then you're better off using the CURL library. Regards Huggie
  12. [quote author=86Stang link=topic=121971.msg502374#msg502374 date=1168534242] Can't I mark this as solved? [/quote] I believe that they're working on the mod for that now, it needs a few changes since the forum upgrade two days ago. Regards Huggie
  13. [quote author=steelmanronald06 link=topic=121678.msg502300#msg502300 date=1168528946] I have gotten the headers on the forums updated, upgraded the font size, and put the Return To Main Site back at the top. [/quote] Ronald, The font size is still not as it was (For the [nobbc][code][/nobbc] tags I mean) and in addition to this, you can only edit your posts for a very short while after you've made them, is this going to remain? [code]See what I mean?[/code] Regards Huggie
  14. Jessi, I noticed the same thing, there's a time limit.  You can only edit your post upto a certain amount of time after it's been posted.  Another 'bug' with the upgrade I'd imagine. Regards Huggie
  15. Yeah, you really needed that unique column  ;D Huggie
  16. Try this: $pack = "SELECT * FROM `packages` WHERE `package_id` IN (". $tour['packages'] .")"; And also, echo $tour['packages'] to a browser first of all to make sure that it's a comma separated list. Regards Huggie
  17. Firstly, It's a bad idea to allow people to upload files into the same folder as your connect page. Secondly, even if they have the name of your connect.php page, they can't view any of the details by running it as it's enclosed in PHP's tags, meaning it gets executed server side. Regards Huggie
  18. I think you should be able to, so long as the user your server is running as has access to the directories. Regards Huggie
  19. PHP is case sensitive... Change this [code=php:0]<?php echo ($_GET["Course"]); ?>[/code] to this [code=php:0]<?php echo ($_GET['course']); ?>[/code] I've replaced the double quotes with single quotes too, but that's just my preference. Regards Huggie
  20. It doesn't look as thought there's a unique column there, is there? Regards Huggie
  21. Also, the code I provided shouldn't cause your server to freeze.  That's probably just coincidence. Regards Huggie
  22. You need to either escape your double quotes in the body or use a different syntax... Change this: [code]$mail->Body = "<table width="236" border="0" cellpadding="0">   <tr>     <td width="83">Name:</td>     <td width="311">$name</td>   </tr> </table>";[/code] To this: [code]$mail->Body = <<<HTML <table width="236" border="0" cellpadding="0">   <tr>     <td width="83">Name:</td>     <td width="311">$name</td>   </tr> </table> HTML;[/code] Or this: [code]$mail->Body = "<table width=\"236\" border=\"0\" cellpadding=\"0\">   <tr>     <td width=\"83\">Name:</td>     <td width=\"311\">$name</td>   </tr> </table>";[/code] Regards Huggie
  23. Try this: [code]<?php //variables taken from form $name=$_POST['name']; $car=$_POST['car']; $location=$_POST['location']; $color=$_POST['color']; //email to settings $to = "chris@epicri.com"; $subject = "testemail"; $headers = "Content-Type: text/html\n\n"; // I added this row //email body (I've used heredoc syntax) $body = <<<HTML <table width="400" border="0" cellpadding="0">   <tr>     <td width="172">Name:</td>     <td width="222">$name</td>   </tr>   <tr>     <td>Location</td>     <td>$location</td>   </tr>   <tr>     <td>Car:</td>     <td>$car<td>   </tr>   <tr>     <td>Color:</td>     <td>$color<td>   </tr> </table> HTML; //Mailto settings mail ($to, $subject, $body, $headers); // I've added the headers variable as the 4th parameter to mail() header("http://www.cbeckserver.com/howworks.html"); ?>[/code] Regards Huggie
  24. I've been hacking away and this code will give you an array keyed on state... the value of this array is another array keyed numerically with the values as the colleges... [code]<?php // Open the file and get the contents into a single string $fh = file_get_contents('http://www.collegebookx.com/text.txt'); // Define the pattern for matching the states and colleges $pattern = '|<H2.*?">(.*?)</H2>(.*?all">)|s'; // Match patern and place into an array preg_match_all($pattern, $fh, $matches); // Sort the matches into seperate arrays $states = $matches[1]; $collegelinks = $matches[2]; // Loop through each state and get the colleges for it foreach ($states as $n => $s){   // Define the pattern for matching the colleges without the http link   $pattern = '|blank">(.*?)</A|s';   // Match patern and place into an array   preg_match_all($pattern, $collegelinks[$n], $c);   // Insert the colleges into arrays keyed on state   $complete_list[$s] = $c[1]; } // Sort the array alphabetically on state ksort($complete_list); //Print the list... foreach ($complete_list as $s => $cl){   echo "<p>\n";   echo "<b>$s</b><br>\n";   foreach ($complete_list[$s] as $c){       echo "$c<br>\n";   }   echo "</p>\n"; } ?>[/code] Regards Huggie
  25. I think this is maybe a job for Google... Regards Huggie
×
×
  • 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.