Jump to content

awjudd

Staff Alumni
  • Posts

    422
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by awjudd

  1. Yes, this would be a good use of a function assuming you re-use it elsewhere in your code. ~awjudd
  2. awjudd

    Spammer

    The WHERE clause below should capture what you are looking for. Use it as the SELECT first to see if it hits everything that you want it to and nothing more, and then you can throw it onto a DELETE. SELECT * FROM `emailtest` WHERE emailaddress REGEXP '[a-z]\.[a-z]+[0-9]{6}@.*' ~awjudd
  3. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=358907.0
  4. Strip the tags using php.net/strip_tags and then do a length check? ~awjudd
  5. You are missing brackets, so the order of operations isn't working as you wanted. $query="SELECT * FROM products WHERE live = 1 AND (title LIKE '%$term%' OR description LIKE '%$term%') ORDER BY id DESC"; ~awjudd
  6. Yup, that would do it ... ~awjudd
  7. That is what your query is doing ... that said since it is an INTEGER, you don't need the quotes around it. SELECT * FROM mytable WHERE user_id=1 ~awjudd
  8. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=358666.0
  9. Given that the issue could be anywhere in your code, I am extremely doubtful that anyone is willing to go through (and jump through hoops while doing it) snippets of source code provide one at a time on a forum. If there is anyone out there willing to do that ... well you have more patience that I do. So either learn PHP and figure it out yourself or hire someone to do it for you. ~awjudd
  10. Hire a developer to go through the application and figure out what the actual issue is? ~awjudd
  11. You can't use AS in your VALUES clause for an INSERT statement. $sql =" INSERT INTO `confirmedorder` (customerid, Prodid, Prodname, pricelb,quantity,price, ordervalue) VALUES ($customerid,$prodid[$i], '$prodname[$i]','$pricelb[$i]', $quantity[$i],$price[$i], " . $quantity[$i] * $price[$i] . " ) "; $this->db->query($sql); ~awjudd
  12. The actual code. ~awjudd
  13. That notice means that you have a variable 'sumordered' (in the code $sumordered) on line 640 of bestelkop.php which is being used without a value being assigned to it. This is just an informational message. I just re-read your first post and you do have or die(mysql_error()) so you should actually be fine without that. If you aren't getting any errors there, then you are connecting to the database correctly but something else in the code isn't working as planned. There were a lot of changes to PHP between PHP4 and PHP5 so I'm guessing you have the use of something that is deprecated. ~awjudd
  14. What do you get appearing all over your website? If after setting those settings, you get notices / errors all over your site it means that your site wasn't built properly (i.e. issues thrown under the rug). ~awjudd
  15. There is no need to go a separate database for each restaurant. In fact, that is not only overkill but a very bad idea. A relational database would definitely do the trick. ~awjudd
  16. <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ~awjudd
  17. Try removing the suppression of the error message on your mysql_query link (i.e. remove the @) then you may see that there is an error there. ~awjudd
  18. Have you tried turning on error reporting / display errors to see if you get anything? ~awjudd
  19. -- Slow SELECT * FROM tableX WHERE status != 'Error' AND id NOT IN (SELECT id FROM tableY) LIMIT 1 -- Faster (should work ... ish) SELECT * FROM tableX AS x LEFT JOIN tableY AS y ON x.id=y.id WHERE x.status != 'Error' AND y.id IS NULL Please Note: the NOT EQUALS and NOT IN are pretty slow options (can't use indexes). ~awjudd
  20. You build the query dynamically. $words=explode(' ', 'foo bar'); $query='SELECT * FROM inventory '; $combine=' WHERE '; foreach($words as $word) { $query .= $combine . " ( title LIKE '%" . $word . "%' or description LIKE '%" . $word . "%' )"; $combine=' AND '; } echo $query; ~awjudd
  21. Split the word on the space then add the LIKE for each one. ~awjudd
  22. awjudd

    SQL Join

    I believe that technically you could use a variable and a case statement but that isn't what the database is made for ... so it is a bad idea! ~awjudd
  23. In order to do what you want, you would have to first get a list of all of the tables in your database and then with that list, build a bunch of queries and run those off separately. That said, this is an absolutely horrible idea. This is going to be slow and completely defies the purpose of storing things in tables. If you need to search on something, then there should be a metadata table or something which all of these link to. ~awjudd
  24. Does the row already exist, or is it a new row? If it already exists, then you need you need to UPDATE it. Otherwise you need to INSERT it. I just noticed that your UPDATE is missing a WHERE clause which means that every row will be updated each time. You probably want to fix that. ~awjudd
  25. You need to use the actual database commands to run the update. <?php $con = mysql_connect("localhost","nawacl_rich","Berrysweet83"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("nawacl_singleparent", $con); $result = mysql_query("SELECT username, user_id FROM bx_users"); while($row = mysql_fetch_array($result)) { mysql_query("UPDATE Profiles SET ID=".$row['userid'].", NickName='".$row['username']."'") ; // <-------------------- This is line #15 } mysql_close($con); ?> ~awjudd
×
×
  • 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.