Jump to content

toplay

Staff Alumni
  • Posts

    973
  • Joined

  • Last visited

    Never

Everything posted by toplay

  1. http://www.phpdoc.org http://www.phpdoc.org/manual.php
  2. I'm not familiar with PDO framework, so make sure they it supports MySQL 5+ by using mysqli_xxx type of functions and not mysql_xxx. Instead of empty string, specify null or 0 (zero) for the id auto_increment column value.
  3. You forgot the quotes around the date values: $query="SELECT * FROM orders WHERE datepaid BETWEEN '$FromDate' and '$ToDate'"; Always check for any possible errors after a query, and before executing any subsequent commands (like mysql_num_rows). If you had, it would have indicated to you the syntax problem in your query. Good luck.
  4. The $wpdb is not recognized inside the install_table() function. There's no () on date and time: date1 time() DEFAULT '0' NOT NULL, time1 date() NOT NULL,
  5. No need for intermediate variable, so you can do: $_SESSION['ownerfirstname'] = $_POST['ownerfirstname']; If you want to assign all $_POST values, you can do something like: foreach ($_POST as $key => $value) { $_SESSION[$key] = $value; } Or create a 2 dimensional array by saving like this: $_SESSION['post'] = $_POST; // access like $_SESSION['post']['ownerfirstname'] But remember to validate/verify all $_POST values before using or saving to DB.
  6. Your post is hard to read...so I'm not looking at it in great detail. When you do joins, you have to tie (specify) both tables together and I don't see you doing that. i.e.: ... ON res.g_uname = com.g_uname WHERE res.g_uname = 'something' ORDER BY ... You also might want to read up about the "GROUP BY" clause. If both tables (residential and commercial) have the same columns, then you can just use a UNION. (SELECT * FROM res WHERE uname = 'username') UNION (SELECT * FROM com WHERE uname = 'username') ORDER BY g_refreshdate DESC That automatically removes any duplicates. FYI: To get duplicates you would use "UNION ALL".
  7. Very unsatisfactory post. You need to be very clear with your questions if you expect members on this forum to respond to you. Issues with your post: 1) You don't show what the current query ($sql value) is. 2) We don't see where or how you're actually running the query (unless get_results() does it, but how are we supposed to know that?). 3) We don't know what get_results() does exactly. We don't know if you're using a database abstraction layer, a home grown function or what. 4) We don't know if get_results() really returns an array, resource object, or an object, or something else. It's up to you to help yourself by putting debug echo's in strategic places in your code to see where things are going wrong.
  8. When using literal values you need to enclose them in quotes (single or double)...WHERE domain = '$domain' Also, I assume "table_stores" is defined as a constant. If it's just a variable, then you've forgotten the dollar sign.
  9. Yes. Specify just the columns you want (data returned). http://dev.mysql.com/doc/refman/5.0/en/select.html
  10. Remove: DEFAULT '0' from clientID line. You can't have a default value on an auto_increment column.
  11. It's best if you use sessions or cookies when wanting to pass data from page to page like for a person registering, purchasing, survey, etc. But if you still want to go with the hidden field route, you can use serialize() to put it on the form, then use unserialize() to read it back. Good luck.
  12. You have numeric customer id's that big, wow. Well, I assume your table column can handle it. Well, put displays to show the full query before it's executed. Take that query and run it outside of PHP, like using myphpadmin. Post actual code and make sure you're properly checking for any MySQL errors (after every call). Display query: <?php $arrUsers[] = 772474564; $arrUsers[] = 1414350111; $arrUsers[] = 20707488; $sql = 'SELECT `rank`, `score` FROM `users` WHERE `userid` IN (' . join (', ', $arrUsers) . ') ORDER BY `rank` ASC'; echo $sql; ?> Above code would produce this query, which you can use to run outside of PHP to see if it works.
  13. ...WHERE userid IN (' . join (',', $users) . ') order by rank ASC'
  14. Yes, good advice aschk. FYI: Instead of three lines, it can be all on one line: <?php echo '<pre>', print_r($_POST, TRUE), '</pre>'; ?>
  15. Change: <input type="hidden" name="id" value="<? $cid ?>"> To this: <input type="hidden" name="id" value="<? echo $cid; ?>"> or short notation (depending on server setting allowing it): <input type="hidden" name="id" value="<?= $cid ?>">
  16. It sounds like you're redirecting endlessly perhaps. Page A redirects to page B, then page B redirects to page A, and so on (endless loop). Or same page keeps redirecting to itself. Please note that the header() with location does not redirect right there and then...only when the script ends or an exit is reached. So, I'm not sure if you're showing us the whole entire code or not. What do you mean firefox says the page is not redirecting like it's supposed to? Please provide exact error messages, or link to site. Try in other browsers too.
  17. toplay

    Very long update

    Why do you need to have B.rank at all? and why two score columns too? You have B.rank as only INT(7) trying to hold A.rank INT(11). The B.id can point (join) to A.id whenever you need to get the rank (A.rank). Your explain doesn't make sense to me...do you have indexes called "name"? Post the actual table structures (create table SQL with indexes). Tables don't seem normalized. FYI - Another way to write the update: UPDATE B JOIN A ON A.id = B.id SET B.rank = A.rank;
  18. Please search the web before posting. http://www.devarticles.com/c/a/MySQL/Blobbing-Data-With-PHP-and-MySQL/ http://www.anyexample.com/programming/php/php_mysql_example__image_gallery_(blob_storage).xml http://www.google.com/search?num=30&hl=en&newwindow=1&safe=off&q=blob+%2Bmysql+%2Bphp
  19. I would imagine something like this: SELECT ne.* FROM nsr_entrants ne JOIN nsr_bibno nb ON nb.entrant_id = ne.entrant_id LEFT JOIN nsr_scores ns ON ns.entrant_id = ne.entrant_id WHERE ns.entrant_id IS NULL ; Based on your sample data, the above query should show only Ken (# 2).
  20. You're missing a closing right curly brace (}) just before/above where editAccount() function/method is defined in process.php. That closing curly brace is needed to finish off register() function/method first. Currently, the editAccount() function/method is enclosed within register() and that's why it can't be found (it's defined or known about until register() is called first).
  21. When posting, please point out what line your error is on so we don't have to guess or count. I assume line 49 is this: if(($currentHealthEnemy - $healthAward) > $minHealth) { Earlier in your code, you assign an array to $currentHealthEnemy: $currentHealthEnemy = mysql_fetch_assoc(mysql_query($querythe)); So, you're trying to subtract a numeric value from the whole of an array....not allowed/possible. Read up on how to properly retrieve data from MySQL.
  22. You can't have a "where" condition after "values" like that in the "insert". You can specify a "select" to retrieve values from another table to be used to "insert" (and for that you place the "select" right after "values"). Look at the Insert syntax in the manual: http://dev.mysql.com/doc/refman/5.0/en/insert.html
  23. You can't have a "where" condition after "values" like that in the "insert". You can specify a "select" to retrieve values from another table to be used to "insert". If wanted to update you can use "ON DUPLICATE KEY UPDATE" option in the "insert" or better yet, use "replace" instead. But since you don't want to do anything if row exists, then just do an "insert" and just ignore the duplicate key error. When row doesn't exist MySQL will add it, and when it does exist it won't add it and return error # 1022. Insert syntax: http://dev.mysql.com/doc/refman/5.0/en/insert.html Error codes: http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html Replace syntax: http://dev.mysql.com/doc/refman/5.0/en/replace.html
  24. Don't output the HTML at the top of your script before using mail() and header(). See pinned topic: http://www.phpfreaks.com/forums/index.php/topic,37442.msg146490.html#msg146490 See "Example#4 Sending HTML email" at: http://us3.php.net/manual/en/function.mail.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.