Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. the function should be function sort_by_value($x, $y) { return ($x['value'] - $y['value']); } a sort function needs to return -, 0 or + values
  2. Is this what you are trying to do? mysql_query("INSERT INTO ".$school_id."_outbox (senderno, destno, message, student_id) SELECT '$senderno', p1contact, '$message', '$student_id' FROM 1_contacts");
  3. here you are $str = date('dmY'); do { $str = (string)array_sum(str_split($str)); } while (strlen($str) > 1); $bgc = '#'. str_repeat($str,6); echo $bgc;
  4. What does echo $q give. If $_SESSION['numbers'] is empty then the query will look like ... NOT IN () ... so try if(!isset($_SESSION['numbers'])){ $_SESSION['numbers'] = array(0); } so you get ... NOT IN (0) ... and avoid a syntax error
  5. Then you are either finding no match or more than 1 match. Always put the query string into a variable so you can echo it if required. $sql = "SELECT foo FROM bar"; $result = mysql_query($sql); In cases like this you can now echo $sql then copy and paste the actual query into phpMyAdmin (or similar) and see what the results are
  6. One approach might be to write some demo sites/applications for prospective clients to try. This would give you a portfolio and build up your experience. But do finish them.
  7. Then fix it. You are either referencing a non-existent column or you have a string value in your query containing "test1" that is not inside quotes. We haven't even seen the query, let alone your table structures, so your pretty much on your own, unless we have a psychic in or midst.
  8. Have you got error reporting on? Have you you checked what mysql_error() returns after running the query?
  9. see what mysql_error() returns after executing the query. also echo($q) to see what was executed
  10. Just because query returns no results does not mean it isn't working. It just means it didn't find any rows that match the WHERE criteria
  11. Use mysql_num_rows($query) to see if any rows were found
  12. Don't worry, mysql will allocate a unique insert id to each connection
  13. Your inputs need name attributes. It is the name and value that is passed in the post (not the id and value)
  14. Already told him that:
  15. alternative method $db = new mysqli(HOST, USERNAME, PASSWORD, 'metrocellars'); $sql = "SELECT l.location , r.region , w.winery_name , w.url , p.label FROM location l INNER JOIN region r USING (lid) INNER JOIN product p USING (rid) INNER JOIN winery w USING (pid) INNER JOIN varietal v USING (vid) WHERE lid = 2 ORDER BY r.region, w.winery_name, v.varietal "; $prevRegion = $prevWinery = ''; $res = $db->query($sql); while (list($loc,$rgn, $wnry, $url, $label) = $res->fetch_row()) { if ($prevRegion != $rgn) { echo "<h3>$rgn</h3>\n"; $prevRegion = $rgn; $prevWinery = ''; } if ($prevWinery != $wnry) { echo "<a href='$url'>$wnry</a><br>\n"; $prevWinery = $wnry; } echo "<span style='margin-left:15px;'>$label</span><br>\n"; }
  16. `word` = 'a' OR `word` = 'b' OR `word` = 'c' OR `word` = 'ab' OR `word` = 'ac' OR `word` = 'ba' OR `word` = 'ca' OR `word` = 'cb' OR `word` = 'abc' OR `word` = 'cba' OR `word` = 'bca' */ can be simplified to `word` IN ('a', 'b', 'c', 'ab', 'ac', 'ba', 'ca', 'cb', 'abc', 'cba', 'bca')
  17. $to is given a value early on in the code only if certain conditions are true. I you later try to output when those conditions are not true then it will be undefined.
  18. You need to escape $img_src as it contains quotes. mysql_real_escape_string
  19. I have just told you the solution
  20. that only proves that the string value "../backend/playlist_form.php" exists
  21. put $img_src in single quotes, not backticks. (Backticks say "this is a column name")
  22. realpath will just return false if the path/file does not exist
  23. Don't assign the $result['isProcessed'] back to $result. $processed = $result['isProcessed'] ? 'yes' : 'n/a'; echo "<td>$processed</td>";
  24. According to the MySQL manual: Note The PASSWORD() function is used by the authentication system in MySQL Server; you should not use it in your own applications. For that purpose, consider MD5() or SHA1() instead. Also see RFC 2195, section 2 (Challenge-Response Authentication Mechanism (CRAM)), for more information about handling passwords and authentication securely in your applications.
  25. I had a look at your elso1.php output and I'm puzzled why the column headings are out of sequence. Did you use the latest version I posted that has the natsort() included?
×
×
  • 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.