Jump to content

Yesideez

Members
  • Posts

    2,334
  • Joined

  • Last visited

    Never

Everything posted by Yesideez

  1. Take a look at PHPMailer. http://phpmailer.worxware.com/ It's free to download and use and is fairly simple to set up, should be what you're looking for.
  2. You can use Javascript to hide the submit button as soon as it is clicked. Just a thought.
  3. Just remembered - some land line numbers in smaller villages are still only 5 digits so where mobile numbers will always be 11 digits, land line (01) numbers can be either 10 or 11 digits. 01xxxxxxxx or 01xxxxxxxxx or 07xxxxxxxxx
  4. I've got a site where users can make posts and I need to check for the presence of phone numbers. Phone numbers can either be 01xxxxxxxxx or 07xxxxxxxxx depending on land line or mobile (total of 11 digits). I think the easiest way to check is to strip out any non-numeric character (can this be done with regex?) which will bring all numbers together, then check with a much simpler regex. I need an if() to check for the presence of either number and return true or false. Big problem is, I've tried to learn this (wasted many hours) and can't get my head around it. Any help would be gratefully appreciated.
  5. A friend has a company on which he currently has a database in MS Access 2007 which is shared on his local network in the office. When he designed and created the database he didn't link two main tables together and now it's grown to over 12,000 records he's asked me to take a look at it. I've successfully converted the data over to MySQL although we're unsure my code has auto linked all the data together that should be so this will require some time in itself. The reason I've emigrated it to MySQL is because there's some things he's asked me to do for him like generate PDF files on the fly of properties when desired and other stuff where PHP is ideal. Ideally he'd like to keep his database running on MS Access because he knows how to edit this (very much still a beginner although he's much better than I am) and he wants to make sure he'll not become unstuck in the future if his database needs attention and I'm not around - him learning PHP/MySQL/HTML is not an option. I've heard PHP can talk to a MS Access database but I've no idea where to start with this - I have dyspraxia so learning how this could be done might take a very long time. He'd also like to give clients a login so they can view/progress info on their properties and logins for his staff so they can view their stuff. All this I can do but the initial problem is his database. It only has two tables, one listing all his customers and the second listing all the work carried out. Although all properties relate to data in the work table not all work can relate back as some work would be a one-off job. What I'd like to know please is how would you tackle this?
  6. I thought this was going to be a pig. The option of only limiting certain words isn't really possible due to the nature of the site. I did think of trying soundex but then, splitting a subject string into separate words then calculating soundex for each and comparing was again a bit off as soundex values aren't unique and, well, soundex values are strings so we're back to square one. Tricky. I think this idea will be binned.
  7. Without any type of help regarding what it is you want to achieve it's pretty difficult but if your "id" field is set to AUTO_INCREMENT then it might not return anythign as AI starts counting at 1 and never 0. If you want to return the total you can use this instead: $total = mysql_query("SELECT COUNT(*) AS total FROM comments WHERE id=0"); $row=mysgl_fetch_assoc($total); echo $row['total']." Clicks\n"; If you're not wanting the SUM() then try TOTAL() but not sure entire what it is you're wanting to do.
  8. I've got a site where people can place posts and I'm wanting to implement a system where users can have up to 5 words in a watch list. When someone makes a post and uses one of these watch words I'd like to fire off an email to whoever has placed a match word in their watch list informing them of the post. Only problem is, I've no idea which is the best way to do this. The database can potentially grow very big and I'm not happy using a LIKE or a stripos() as I'd like to keep the routine optimised as much as possible to help save resources. If there isn't any simple way of doing this then I'll knock it on the head. The watch list will be used on a VARCHAR(40) which is kind of like a subject string.
  9. You're right - well spotted I had no need to access that table in this call and no idea why I tried adding it. EDIT: I also removed GROUP BY as it wasn't needed. What is needed is some sleep ><
  10. I think I'm far too tired. I removed the line joining the users table and it works perfectly.
  11. SELECT i.*,tp.x,tp.y FROM items AS i INNER JOIN users AS u ON u.postcode=sp.outcode INNER JOIN postcodes AS sp ON sp.outcode='EX8' INNER JOIN postcodes AS tp ON tp.outcode=i.outcode WHERE ((tp.x<(sp.x+16093.44) AND tp.x>(sp.x-16093.44)) AND (tp.y<(sp.y+16093.44) AND tp.y>(sp.y-16093.44))) AND i.description LIKE '%apple%' GROUP BY i.id ORDER BY i.added DESC The error I get is "#1054 - Unknown column 'sp.outcode' in 'on clause'" Any idea on how I can get around this please?
  12. I did try this: SELECT u.userid,u.username,z.active,z.idle FROM users AS u LEFT JOIN onlinetime AS t ON u.userid=t.userid LEFT JOIN (SELECT userid,SUM(active) AS active,SUM(idle) AS idle FROM onlinetime) AS z ON u.userid=z.userid Doesn't work Tried this as well to no avail: SELECT u.userid,u.username,z.active,z.idle FROM users AS u LEFT JOIN (SELECT userid,SUM(active) AS active,SUM(idle) AS idle FROM onlinetime) AS z ON u.userid=z.userid ORDER BY z.active DESC LIMIT 20
  13. I've got a couple tables: users; onlinetime The users table contains loads of info including userid, username, activitycount and the onlinetime contains id, userid, date, active, idle. The field userid is what ties both tables together and active and idle are both integers (seconds). Where the users table has one entry per user (as is normal) the onlinetime table can have multiple entries per user. What I need to do is make a query to list all the users who have activity count as 0 and the sum(active) in onlinetime below a certain number, let's say 100. If the onlinetime had only one entry per user I'd be able to write the query but it's the multiple entries in the onlinetime table that's throwing me.
  14. Oh wow is it really that simple? Thank-you for that - really is appreciated!
  15. Hi, I have a page of HTML and inside this page is a TABLE and it's this table I need to extract some data from. <th>Proxy:</th><td><span class="red">Confirmed proxy server.</span> (<a href="/proxy-server">Read about proxy servers</a>)</td> The first TH cell will always have that content but I need to extract everything between the next TD cell including the HTML. I can strip any HTML out myself if present, just needing help with Regex as I have no clue whatsoever about this as I just cannot get my head around it and I've spent hours! Any help with this would be gratefully appreciated.
  16. Sorry query should be: $checkuser=mysql_query("SELECT `id` from `tbl_users` where username = '".$user."' and password='".md5($password)."'");
  17. Oh, and rather than store the username and other info of a successful login inside session variables - store the row ID number instead then just look that up each time. $checkuser=mysql_query("SELECT `id`,`forename`,`usertype` from `tbl_users` where username = '$user' and password='".md5($password)."'");if (mysql_num_rows($checkuser) > 0) { //have we got any results to process? $row=mysql_fetch_assoc($checkuser); $_SESSION['uID']=$row['id']; header("Location: index.php"); exit; } else { //if not display login form with message that says logon details are incorrects echo 'Do something else' ; } Then on other scripts read the user details from the uID session var from the user table each time and validate there.
  18. If you can edit your post - please do and place CODE tags around the code above.
  19. MD5() is not a MySQL function - try this: $checkuser=mysql_query("SELECT * from `tbl_users` where username = '$user' and password='".md5($password)."'");
  20. if ($name = 'bob') When you're checking with if() you need to use the double equals like this: if ($name == 'bob') That checks "if equal to". In your original code you were assigning $name to be "bob" and the result of that is true because $name was successfully given the value "bob"
  21. OK I'm not sure if this is a question of your SELECT query needs to be edited or PHP. Let's say this is your query (I'm guessing as you've not given me much to play with) SELECT dt FROM table WHERE field=condition If you want to reverse the output you'd use this: SELECT dt FROM table WHERE field=condition ORDER BY dt DESC
  22. If you place a variable inside single quotes you'll get the name of the variable (ie. exact text) and not the contents. Try this: $ORGtext= file_get_contents($path); You can place variables inside double quotes and get their contents - this is the difference between single and double quotes.
  23. Any chance you can post the structure of the tables you want to read and the contents of the function "cleanquerydata()" please?
  24. I'm not sure what issue you're actually having - the data held inside $d_dailtstatistics is an array so you can access any piece of data in any order. You might find it easier if you use mysql_fetch_assoc() instead as you can read the array by name rather than index. For example, if you had the date in your table as "dt" then you would use this to access it: echo $d_dailystatistics['dt'];
  25. I tried reading through that but got lost but can add one bit. You've got a large chunk of links being thrown out and you can tidy that up a bit. <a href="<? echo $siteurl; ?>/bio.php?username=<? echo $username; ?>" class="mwtabslink">Biography</a> Can be cut down to: makeURL($siteurl,$username,'Biography'); Then you have a function to make the link: function makeURL($url,$uname,$str) { echo '<a href="'.$url.'/bio.php?username='.$uname.'" class="mwtabslink">'.$str.'</a>'."\n"; } The "\n" on the end isn't needed, it just helps reading the source easier if you "View Source" in your browser.
×
×
  • 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.