Jump to content

Howlin1

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Everything posted by Howlin1

  1. When I try print some news stories to my homepage I get the following error: SELECT Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) The code that I am using is: <?php require ('news/news.php'); ?> and in the news.php file that code is: <?php include 'inc/connect_db.php'; $result = mysql_query("SELECT * FROM site_news") or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); while ($get_info = mysql_fetch_row($result)) { echo "<td>{$get_info[1]}</td>"; } ?> If I go to the news.php file itself, the code will run and I can see the news story that I have. I have tried using require, require_once, include and include_once but they all come up with the same error. What am I doing wrong?
  2. Anyone?
  3. Anyone able to help?
  4. The information that you call is what's in the name attribute and not the label. So instead of $_POST['t1'] you should have $_POST['QL_name'] etc etc
  5. Have you tried sending the email (content included) to a non gmail address?
  6. What I am seeing is that you haven't set it so the email won't send if one or both of your requirements aren't met. So you need it like if (validatePhone($phone)) { if (check_email_address($email)) { send email } else { invalid email } } else { invalid phone number } So in that case the email will only send if both the phone and email are valid.
  7. I have tried that. I have also tried putting $to = $email and $to = $from and nothing will send to my gmail account but it will send to my hotmail. (I am sure the file is up to date and I use correct email addressed.)
  8. Your form does work when I put my gmail or hotmail email address into it, but when I try and send one to my gmail (via the form you linked to in the zip) it won't send, but it will send an email to my hotmail address.
  9. Yes. The emails will deliver to a hotmail email (granted they get sent to the junk mail) but not a gmail one. @Jacbey I tried that form and it wouldn't send it to my email address.
  10. I got a reply back. I can send an email to a hotmail account but not a gmail account. Me: What would the reason behind the email not being sent to the gmail account? Host: That's generally a mystery deep in the mind of Google I'm afraid. Getting any sort of visibility out of them on that is an eternal struggle. To me that sounds like they don't know. It looks like I'll have to (try) email google and ask them :/
  11. No, I didn't know it might depend on my host. I'll drop them an email and ask. Thanks
  12. @ DevilsAdvocate I did echo out the variables and they contain what they are meant to contain. I even removed everything in the script and put in information myself, and still nothing. I have added the full script as an attachment. @voip03 I did that and still nothing. [attachment deleted by admin]
  13. I didn't put the full script because it wasn't really needed, but there is a value for $Email_address. I didn't put the full script because it wasn't really needed, but there is a value for $Email_address (but it's an attachment now). I only put that in to see if it was saying it was sent. It will be taken out as soon as it does actually work. I only put that in to see if it was saying it was sent. It will be taken out as soon as it does actually work. [attachment deleted by admin]
  14. Hello, I have a registration page and when a user registers I want to send their email an activation code. To test I have the following code. <?php //Send activation Email $to = $Email_address; $subject = "www.WEBSITE.com/"; $message = "Welcome to my website!\r\rYou, or someone using your email address, has completed registration at WEBSITE. You can complete registration by clicking the following link:\rhttp://www.WEBSITE.com/register.php?action=verify&$activationKey\r\r If this is an error, ignore this email and you will be removed from our mailing list.\r\rRegards,\ "; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); if (mail($to, $subject, $message, $headers)) { echo 'Success'; } else { echo 'Error'; } ?> I have the last if else to see if it is sent to not. I do get a Success message, but I don't get an email at the address (I have checked the spam folder). I have checked the email address and it is correct. I have even waited a few hours and nothing. Why is the email not getting to my account?
  15. Thanks works like a charm!
  16. Hello, Say I have a url http://www.somedomain.com/abc/view.php?id=Mountain--troll---D&D--2- And "Mountain troll -D&D 2-" is an entry in a database with information. The problem that I am having is since I have an ampersand in the url it is being treated as two different strings (Mountain troll -D being one and 2- being the second). I know I can solve the problem by just not using an ampersand in the database entry name, but for arguments sakes lets say I can't remove it. Would it be possible for it to be treated as one long string ignoring the ampersand?
  17. Thanks all who helped, I have gone with the ENUM method because it will allow me to do what I want. I have attached a picture of the result. It is exactly what I wanted! Thanks again [attachment deleted by admin]
  18. @PFMaBiSmAd Sorry. I tried $result= mysql_query( "SELECT * FROM college_free_rooms ORDER BY FIND_IN_SET('Monday, Tuesday, Wednesday, Thursday, Friday', Day) ASC ") or die("SELECT Error: ".mysql_error()); and got attachment 1. I tried $result= mysql_query( "SELECT * FROM college_free_rooms ORDER BY FIND_IN_SET('Monday, Tuesday, Wednesday, Thursday, Friday', Day) DESC ") or die("SELECT Error: ".mysql_error()); and I got attachment 2. I tried $result= mysql_query( "SELECT * FROM college_free_rooms ORDER BY FIND_IN_SET('Monday, Tuesday, Wednesday, Thursday, Friday', Day) DESC ") or die("SELECT Error: ".mysql_error()); and I got attachment 3. I tried $result= mysql_query( "SELECT * FROM college_free_rooms ORDER BY FIND_IN_SET('Monday', Day) ") or die("SELECT Error: ".mysql_error()); and I got attachment 4. EDIT: What are they? I haven't come across them. [attachment deleted by admin]
  19. I'm not quiet sure how that would help? I tried that, but it didn't help, I tried using ASC, DESC and I even left it out asc or desc and it didn't change anything. I tried using different days, but nothing?
  20. Hello, I am wondering is there any way to sort a list by the days of the week (i.e. it should list Monday, Tuesday, Wednesday, Thursday and Friday)? I am trying to make timetable of free rooms in a building and list the weekdays (Monday - Friday), Floors (Ground, first and second) and then the time (9 am until 4pm, but I have that solved by using the 24 hour time). What I have at the moment is: $result= mysql_query( "SELECT * FROM free_rooms ORDER BY Day, Floor, Time ASC") or die("SELECT Error: ".mysql_error()); echo '<p>This is a list of all the rooms that are free and on what day.</p> <table border="1" width="400"> <tr align="center"> <td><b>Day</b></td> <td><b>Floor</b></td> <td><b>Room</b></td> <td><b>Time</b></td> </tr>'; while ($get_info = mysql_fetch_row($result)) { print '<tr align="center"> <td><b>' . $get_info[1] . '</b></td> <td>' . $get_info[4] . '</td> <td>' . $get_info[2] . '</td> <td>' . $get_info[3] . ':15</td> </tr>'; } print ' </table>'; mysql_close($link); ?> (The result of the above is Attachment 1) (I'm assuming the get_info is a 2d array) So what I would need to do is to sort the get_info[1] array so Monday is first, Tuesday, Wednesday, Thursday and finally Friday. Then sort the floor (get_info[4]) by Ground, First and Second, while keeping Monday first. On the order by clause I did try putting in ('Monday') for the day, but it only brought one or two of the Mondays to the top. I don't know enough about php (I'm a novice really) to do what I would like to do. The other way I did think of doing it was like: $result= mysql_query( "SELECT * FROM college_free_rooms") or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); echo ' <p>This is a list of all the rooms that are free and on what day.</p> <table border="1" width="400"> <tr align="center"> <td><b>Day</b></td> <td><b>Floor</b></td> <td><b>Room</b></td> <td><b>Time</b></td> </tr>'; while ($get_info = mysql_fetch_row($result)) { if($get_info[1] == 'Monday') { print ' <tr align="center"> <td><b>' . $get_info[1] . '</b></td> <td>' . $get_info[4] . '</td> <td>' . $get_info[2] . '</td> <td>' . $get_info[3] . ':15</td> </tr>'; } if($get_info[1] == 'Tuesday') { print ' <tr align="center"> <td><b>' . $get_info[1] . '</b></td> <td>' . $get_info[4] . '</td> <td>' . $get_info[2] . '</td> <td>' . $get_info[3] . ':15</td> </tr>'; } if($get_info[1] == 'Wednesday') { print ' <tr align="center"> <td><b>' . $get_info[1] . '</b></td> <td>' . $get_info[4] . '</td> <td>' . $get_info[2] . '</td> <td>' . $get_info[3] . ':15</td> </tr>'; } if($get_info[1] == 'Thursday') { print ' <tr align="center"> <td><b>' . $get_info[1] . '</b></td> <td>' . $get_info[4] . '</td> <td>' . $get_info[2] . '</td> <td>' . $get_info[3] . ':15</td> </tr>'; } if($get_info[1] == 'Friday') { print ' <tr align="center"> <td><b>' . $get_info[1] . '</b></td> <td>' . $get_info[4] . '</td> <td>' . $get_info[2] . '</td> <td>' . $get_info[3] . ':15</td> </tr>'; } } print ' </table>'; mysql_close($link); ?> But that didn't work either, but I did it on the assumption since I wasn't specifically telling the sql statement to order the list in any way, that the result would print out all the Monday entries first, then the Tuesday entries etc, but it didn't work that way (attachment 2). Is there anyway that what I want done, can be done (wholly or partially)? [attachment deleted by admin]
  21. Thank you so much! I was able to get it done in the end. It took me a bit longer than I had thought it would but nonetheless it's done now. Thanks alot!
  22. While that does make the footer stick to the bottom of the browser, it doesn't make the sidebars go down to the footer. Example
  23. For a college assignment I was required to make a website. It is after getting graded but I would like to continue to at least try to improve my site. One of the problems I had was the height of the sidebars. I have used css to a certain extent. But what I would like to know is; how to change this to this Essentially I want the sidebars in the first link to extend down to the bottom of the users browser like in the second link. At the moment I have that working with some javascript and I have heard this problem can be solved using css and html only.
  24. Ah okay thanks, I'm still pretty much a noob at php. Is there any other language it could be done in? I am asking because since I have it in javascript, users might have Javascript disabled or maybe their browser doesn't support javascript (for whatever reason). Or will I need to go to another forum and ask?
  25. PHP executes on the SERVER and has no idea what a browser is let alone its window size. I'm sorry, but how come you are able to get PHP to print to the users screen, what browser, browser version etc the user has?
×
×
  • 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.