Jump to content

awjudd

Staff Alumni
  • Posts

    422
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by awjudd

  1. awjudd

    SQL Help

    Do you have indexes on either of the tables? I would also suggest against using the ANSI JOINs (,) and move to using INNER JOINs because you will not be CROSS JOINing your dataset. SELECT pd.product_id, pd.product_name, pp.sales_price_inc_vat, ptc.* FROM product_data pd JOIN product_pricing pp ON pd.product_id = pp.product_id JOIN products_to_categories ptc ON pp.product_id = ptc.product_id ~awjudd
  2. Old: juddster New: awjudd Please and thank you
  3. 1 day 7 hours ... time is ticking! gogogogogogo
  4. Echo the up_for value: echo $arr [ 'server_info' ] [ 'up_for' ]; You would use one of the string functions (i.e. http://php.net/manual/en/function.date.php) to convert the time to a readable time. ~juddster
  5. You need to use the period (.) to concatenate strings not the plus sign (+). ~juddster
  6. // Assuming $arr is your array name (the one you are print_r'ing). echo 'Players: ', implode(',', $arr['players']); This will emit all of the players in a CSV. ~juddster
  7. There is no shorthand. You need to split it out. ~juddster
  8. Yes you do. Anything from the user should be sanitized. ~juddster
  9. I think you are missing a / in front of the path in readfile. As it stands right now, it is looking in a subdirectory for a var/www/vhosts... when I think you actually want it to be from /var/www .... And how is $name populated, you never said in your post. If you echo the actual path you are passing into readfile, is it the file you expect? ~juddster
  10. Are you sending in a query parameter called "userinput"? If you aren't then your script is looking for that (i.e. $_GET['userinput'] looks there). Side Note: You should be careful and sanitize your input because someone could SQL inject you there. ~juddster
  11. This seems to be a JavaScript related question and not a mysql one. You will need to just bind to the onchange event and update all of the other fields which correspond to the gender to say the same value. ~juddster
  12. It is happening because the $_GET variable 'option' doesn't exist (i.e. it is not in your query string). You can resolve this by doing something like ... $option = ''; if ( isset ( $_GET [ 'option' ] ) ) { $option = $_GET['option']; } That said, this is a fairly big security risk leaving it open like this ... ~juddster
  13. @Drummin - Oh God no! CROSS JOINing each of the tables for this is a bad idea. As well, you will get an ambiguous column error if you do that because $field is in all of them (not to mention your code is very susceptible to SQL injection). // Validate the field type $availableFields = array ( 'postcode', 'location', 'company_name' ); if ( ! ( in_array ( $_POST [ 'field' ], $availableFields ) ) { die ( 'Invalid Field Selected.' ); } $field = $_POST [ 'field' ]; $var = mysql_real_escape_string ( $_POST [ 'var' ] ); $query = 'SELECT 'freeuser' AS usertype, id, company_name, location, postcode FROM freelistings WHERE ' . $field . ' LIKE \'%' . $var . '%\' UNION ALL SELECT 'basicuser' AS usertype, id, company_name, location, postcode FROM basicpackage WHERE ' . $field . ' LIKE \'%' . $var . '%\' UNION ALL SELECT 'premiumuser' AS usertype, id, company_name, location, postcode FROM premiumuser WHERE ' . $field . ' LIKE \'%' . $var . '%\''; That said, I have to agree with everyone else who suggests against using multiple tables to store this information. It just plain old doesn't make sense. ~judda
  14. SELECT `tbl_a`.* AS A, `tbl_b`.* AS B FROM `tbl_a`,`tbl_b` WHERE B.`status`<> 'YES' OR B.`status` IS NULL; ~juddster
  15. I'm guessing you want to order the letters stored in a text field in the database. Is this correct? If yes, the fields aren't meant to work that way. ~juddster
  16. SELECT userid, birthday FROM users WHERE birthday BETWEEN DATE_ADD(CURDATE(), INTERVAL 30 YEAR) AND DATE_ADD(CURDATE(), INTERVAL 18 YEAR) ~juddster
  17. Please provide us with your current query. ~juddster
  18. If in your login script you have $_SESSION['username']=$username; then anywhere else in the application (assuming you called session_start()) you can access it through $_SESSION['username']. ~juddster
  19. Yes, that is an assignment and if it is on a page that doesn't have $username defined then it will clear the value. ~juddster
  20. I would assume that would be the default reaction of many people given that the account name is "debian system maintenance" ... pulling at straws here ... but seems important ~juddster
  21. If applications made stuff, then don't delete it. You should only mess around with stuff you created yourself. They weren't created for no apparent reason. The phpmyadmin one was created so you can have the bookmarking and stuff that is built into phpmyadmin. ~juddster
  22. By defining that variable? $displaySuccessMsg = NULL; Or by checking if it is set before using it? if(isset($displaySuccessMsg) { echo $displaySuccessMsg; } ~juddster
  23. Your table is likely huge, so you would need to expand the amount of allowable memory for PHP. ~juddster
×
×
  • 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.