Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. Hi Mike. Welcome to the forums I'm sure you'll learn a great deal here
  2. Sorry bostonjim, I was still sleeping. I'll make sure to get up at the crack of dawn to answer your question.
  3. They're spamming themselves for freelance work.
  4. What happens exactly? Do the apache error logs say anything? Not sure what this means.
  5. That's loosely typed languages for you....
  6. If you want to print out the query, you must assign a variable to it first: $query = "SELECT * FROM products WHERE ProdName LIKE '$safe_search' $limit"; $result = mysql_query($query) or die('Error: ' . mysql_error()); //perform query, or die trying. echo "Query: " . $query; (Now, you must use $result to access the result set) And again, if you want to match any string that contains $safe_search you must use the '%'s.
  7. What's your question?
  8. How doesn't it work? Works for me as well. When I echo $date i get: Monday 21-Jun-10 15:36:58 GMT
  9. If you want to match any string with that value in it you have to use: LIKE '%{$safe_search}%'"; If $safe_search is 'black' then this will match black along with any amount of characters before and after.
  10. You put the or die on the wrong line. Change this line to: $query = mysql_query("SELECT * FROM products WHERE ProdName LIKE '$search'"); to: $query = mysql_query("SELECT * FROM products WHERE ProdName LIKE '$search'") or die("Error: " . mysql_error()); and this line: $numrows = mysql_num_rows($query) or die("Problem with the query: $query " . mysql_error()); to: $numrows = mysql_num_rows($query);
  11. I did that. As a test, I commented out the mysql_real_escape lines and just echoed the $_POST variables and they showed up. It seems like something happens when they mysql_real_escape lines are executed because if I try to echo the $usr and $pwd variables, nothing shows up, but the $_POST variables will. That's impossible unless your strings are made up of newlines, carriage returns and quotes... Please do this and reply with the output: echo "BEFORE"; echo "usr: " . $_POST['usr']; echo "pwd: " . $_POST['pwd']; $usr=mysql_real_escape_string($_POST['usr']); $pwd=mysql_real_escape_string($_POST['pwd']); echo "AFTER"; echo "usr: " . $usr; echo "pwd: " . $pwd;
  12. Instead of echoing out the HTML why don't you just break out of PHP, display the HTML and break back in? //If we submitted the form if(isset($_POST['submitMe'])) { ?> ; // Rest of code
  13. Yeah it was just Salathe... no one really cares about him anyway.
  14. What function?
  15. There was actually 3
  16. Hate when that happens
  17. Before looking at your code turn on max error_reporting: ini_set ("display_errors", "1"); error_reporting(E_ALL);
  18. You don't need a regex for that. var username = 'myusername' var password = '12myusername89' if(password.indexOf(username) != -1) { } else { }
  19. Can you post your current code for that error? Seems like code keeps getting mixed around.
  20. Did you resolve your issue(s)?
  21. Well that means that your search was valid but didn't yield any results. That's really impossible for us to answer but, it does look like you would want to use '$search' instead.
  22. I think your query is failing because you need single quotes around $trimmed in the LIKE clause. I also added some error handling: $query = mysql_query("SELECT * FROM products WHERE ProdName LIKE '$trimmed'"); if($query) { $numrows = mysql_num_rows($query); } else { echo "Error: " . mysql_error(); die(); //or do whatever }
  23. You're calling mysql_query() twice. Take out this line: $numresults = mysql_query($query); And change this: $numrows = mysql_num_rows($numresults); to: $numrows = mysql_num_rows($query);
  24. Did you try the manual? http://us3.php.net/manual/en/function.header.php
×
×
  • 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.