Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. Me too, but I had to tidy up the if statement too... [code] <?php     $to = "myemail@hotmail.co.uk";     $from = "janedoe@anotherfakedomain.com";     $subject = "This is a test email";     $message = <<<EOF <html>   <body bgcolor="#ffffff">     <p align="center">         <b>Hello World!</b>     </p>   </body> </html> EOF;     $headers  = "From: $from\r\n";     $headers .= "Content-type: text/html\r\n";     $success = mail($to, $subject, $message, $headers);     if ($success) {         echo "The email to $to from $from was successfully sent";     }     else {         echo "An error occurred when sending the email to $to from $from";     } ?> [/code] Regards Rich
  2. No, you shouldn't be getting a form, you should be getting one of two messages... 1. The email to johndoe@fakedomain.com from janedoe@anotherfakedomain.com was successfully sent or 2. An error occurred when sending the email to johndoe@fakedomain.com from janedoe@anotherfakedomain.com Regards Rich
  3. I'm not sure I understand exactly, but if I do, then try this bit of code. If it doesn't give the result you're expecting, we may need some additional clarification as to what you're after. [code=php:0] $sql = "SELECT * FROM literary_devices_hold WHERE maximid = (SELECT max(id) FROM wisdom)"; [/code] Regards Rich
  4. The idea when using md5 is to encrypt the password before you insert it into the database.  When a user enters his username and password to log in, you encrypt the password again using md5, and then compare it with what's in the database.  You don't decrypt. It means users cant have their old one sent to them if they forget it, but they can have it reset. Regards Rich
  5. Surely rotating ads on a timer is a bad idea. If I go to a page with a banner at the top and I scroll down to read that page, it's going to make no sense if that banner changes to something else after five minutes, as I won't be able to see it. I think you'd be better coding the server-side to deal with which banner's are shown when, and just have the front-end display them.  It means not having to use JavaScript and probably better control over what's seen where and when. There's some examples of such [url=http://www.phpclub.net/?m=app&s=62]here[/url] that maybe able to give you a few ideas. Regards Rich
  6. Corbin, [code=php:0] mysql_query($sql); [/code] Is already included after the statement itself, but it's just included in complete.php Regards Rich
  7. Don't change the [b]date[/b] field to [color=green]int(10)[/color].  Change its type to [color=green]date[/color]. Regards Rich
  8. oh ok.... I've noticed the problem it's around the date format.... [b]sysdate()[/b] will give you a value like [color=green]'0000-00-00 00:00:00'[/color] but you're trying to insert into a [color=red]date[/color] field that looks like this [color=green]'0000-00-00'[/color] So you need to change the [color=red]date[/color] field to [color=red]datetime[/color] or swap [b]sysdate()[/b] for [b]curdate()[/b]. Regards Rich
  9. I don't know much about MySQL, but why not try... [code] $sql = "INSERT INTO jobs         (jobtitle, location, payrate, hours, jobdescription, jobcat, branch, time, position, date, expire)         VALUES         ('$jobtitle', '$location', '$payrate', '$hours', '$jobdes', '$jobcat' '$branch', '$time', '$poscla', SYSDATE(), '$expire')"; mysql_query($sql) or die ( "Problem with the query: $sql<br>" . mysql_error() ); [/code] All I've done is specify which columns to explicitly insert into, and dropped your initial column as I assumed it's an autoincrementing primary key.  Which is probably where the problem lies if you're trying to insert 'null' into it. Rich
  10. Might not be appropriate, but why not use the email address AS the username, people are less likely to forget their email than their username and then you don't have to worry about additional overhead in your code. Just a suggestion  ::) Regards Rich
  11. Try this... [code=php:0] $query = "SELECT * FROM admin WHERE userid = '$id'"; $result = mysql_query($query); if (!$result){   die('Could run query: ' .mysql_error()); }   if(mysql_fetch_row($result)){ // We're only expecting one row, so mysql_fetch_row should be fine   echo '<a href="form.php">Go back</a> username is taken! } [/code] Regards Rich
  12. Try this.... In Firefox, get the config on the screen by typing [color=green]about:config[/color] in the addressbar, then scroll down to the value labelled [b]network.automatic-ntlm-auth.trusted-uris[/b], double click it and add your intranet address in there. Restart Firefox (Not sure if this is required, but better safe than sorry). Let me know if this works. Regards Rich
  13. Sorry, did I not make it clear enough ;) Rich
  14. Incidently, Ruby's not that different from either PHP or Perl in syntax, some even say it's easier. If you get a spare five minutes, it's not a bad language to learn ;) Regards Rich
  15. Check out this link.... http://www.rubyonrails.org/ Regards Rich
  16. Oracle has it too... 'rownumber' it's a psuedocolumn. Regards Rich
  17. Why not use an absolute URL instead of a relative URL? If you put: [code]<img src="http://www.example.com/images/myimage.png" />[/code] instead of something like: [code]<img src="../images/myimage.png" />[/code] It shouldn't matter where the file's located. Regards Rich
  18. You have random spaces in the field... Take a look at your first example.. http://www.djgrammy.be/index2.php?content=agenda Kafka Groovy Night appears at the top instead of three from bottom... If you look at the SQL dump, you'll see the date value for that field is not '2006-09-29' it's actually ' 2006-06-29'. [color=red]<-- Notice the space before the date[/color] That's what my money's on....  Your database allows this as the field type for 'date' is set to varchar as opposed to date. Regards Rich
  19. You need to post your code, otherwise we won't be able to help  :( Regards Rich
  20. Here's one of the situations where AJAX may actually be appropriate.  Lots of people are using it in the wrong place, or just using it for the sake of it, but you could do well to use it here. This will give you an initial list of cats, when you click on a link to one of them, it can create another list next to it with the items in that cat.  It will do this without refreshing the page, just going and getting the latest data from the database using an HTTP request object via JavaScript. Check out this very simple tutorial at [url=http://www.ajaxfreaks.com/tutorials/1/0.php]AJAX Freaks[/url] Regards Rich
  21. If you're going to go the selecting distinct way, I'd do it like this.... [code] <?php   $sql = "SELECT DISTINCT product_id FROM table_name"; // Initial select to get your distinct ID's   $result = mysql_query($sql);   while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){       $in .= $row['product_id'] . ","; // Concatenate the ID's to the end of the string, followed by a comma   }   $in = rtrim($in, ","); // Remove the last comma   $sql2 = "SELECT column_name, column_name2, column_name3, FROM table_name WHERE product_id IN ($in)"; // SQL with ready-build 'IN' list ?> [/code] Regards Rich
  22. What's the error, can you give us the code? Regards Rich
  23. Yeah, the code looks good, although you don't need this [code=php:0] $ip = $_POST['$ip_adrs']; [/code] And the value you should be inserting into the database is $ip_adrs not $ip. Regards Rich
  24. You can get the users IP address by using $_SERVER['REMOTE_ADDR'] However, bear in mind users can have multiple IP addresses if they get assigned to them automatically by the ISP. Regards Rich [color=red]Edit: I'm too slow again[/color]
  25. [quote]he said he coded it it like that ( mutliple user tables ) to make it faster etc.[/quote] How odd.... So do you have some existing code we can look at?  He must either be looking at rownum or a auto incrementing ID or something. Maybe show us the code used to 'insert a new user' into the DB? Rich
×
×
  • 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.