transfield Posted December 29, 2020 Share Posted December 29, 2020 Hi, this query runs fine when I run it from PHPMyAdmin: UPDATE `tran_term_taxonomy` SET `description` = (SELECT keyword from `good_keywords` ORDER BY RAND() LIMIT 1,1) WHERE `tran_term_taxonomy`.`taxonomy` = 'post_tag' AND `tran_term_taxonomy`.`description` = "" LIMIT 1 However, when I run the same query in a PHP file on my server, the page doesn't load at all. The message I get is: www.somesite.com is currently unable to handle this request. HTTP ERROR 500. This is my PHP code: <?php include("/database/connection/path/db_connect.php"); $result4 = mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE `tran_term_taxonomy` SET `description` = (SELECT keyword from `good_keywords` ORDER BY RAND() LIMIT 1,1) WHERE `tran_term_taxonomy`.`taxonomy` = 'post_tag' AND `tran_term_taxonomy`.`description` = "" LIMIT 1"); echo $result4; ?> So how do I make this query work please? Thanks for your guidance. Quote Link to comment https://forums.phpfreaks.com/topic/311947-mysql-query-works-in-phpmyadmin-but-doesnt-work-in-a-php-file/ Share on other sites More sharing options...
Solution Barand Posted December 29, 2020 Solution Share Posted December 29, 2020 Try changing the `tran_term_taxonomy`.`description` = "" to `tran_term_taxonomy`.`description` = '' It won't like you using " in a string enclosed by ".." 1 Quote Link to comment https://forums.phpfreaks.com/topic/311947-mysql-query-works-in-phpmyadmin-but-doesnt-work-in-a-php-file/#findComment-1583511 Share on other sites More sharing options...
transfield Posted December 30, 2020 Author Share Posted December 30, 2020 On 12/29/2020 at 10:43 PM, Barand said: Try changing the `tran_term_taxonomy`.`description` = "" to `tran_term_taxonomy`.`description` = '' It won't like you using " in a string enclosed by ".." Thanks a lot. It worked 🙂 happy new year to you 🙂 Quote Link to comment https://forums.phpfreaks.com/topic/311947-mysql-query-works-in-phpmyadmin-but-doesnt-work-in-a-php-file/#findComment-1583537 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.