Vizonz Posted July 14, 2010 Share Posted July 14, 2010 Fixed the include problem now this is a problem Also ken helped me with some scripts and when i try to run them on the server now i get Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in on line 25 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in / these work fine locally but not on the server Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/ Share on other sites More sharing options...
ocpaul20 Posted July 14, 2010 Share Posted July 14, 2010 and the error message is......? Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085662 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 $query = "SELECT DISTINCT requestlist.songID, songlist.ID, requestlist.ID, songlist.artist, songlist.title, songlist.count_requested, songlist.composer, requestlist.status FROM radio.requestlist INNER JOIN radio.songlist ON requestlist.songID = songlist.ID WHERE requestlist.status = 'played' GROUP BY requestlist.status, songlist.title, songlist.artist ORDER BY songlist.count_requested DESC, songlist.artist DESC LIMIT 30; "; $result = mysql_query ($query) or die("Query error: ". mysql_error()); $num=mysql_num_rows($result); echo "<ol>\n"; while ($row = mysql_fetch_assoc($result)) { echo "<li> {$row['artist']} - <a href='{$row['songID']}'>{$row['title']}</a> ({$row['count_requested']} ) </li>\n"; } echo "</ol>\n"; ?><br /> and i am getting Query error: SELECT command denied to user i am still learning but i am taking a guess that i dont have privledges set up on that database for that user. what do i run through phpmyadmin to grant that Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085669 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 Those errors simply mean your query failed and you have done nothing to catch the error. Take look at mysql_error to see what the actual error is then try and fix it. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085674 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 Those errors simply mean your query failed and you have done nothing to catch the error. Take look at mysql_error to see what the actual error is then try and fix it. Kinda lost me what exactly i do ? i am learning so when you say that it kinda means nothing to me LOL sorry to be blunt but i am clueless about this Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085676 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 like i am completely lost i have the exact same code running locally and it works without a problem Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085678 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 Actually, your calling.... or die("Query error: ". mysql_error()); which should show you the data you need. I'm not sure if the code you have posted is actually the code causing the problem now. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085680 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 Actually, your calling.... or die("Query error: ". mysql_error()); which should show you the data you need. I'm not sure if the code you have posted is actually the code causing the problem now. okay lets start from here include("dbinfo.inc.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT DISTINCT requestlist.songID, songlist.ID, requestlist.ID, songlist.artist, songlist.title, songlist.count_requested, songlist.composer, requestlist.status FROM radio.requestlist INNER JOIN radio.songlist ON requestlist.songID = songlist.ID WHERE requestlist.status = 'played' GROUP BY requestlist.status, songlist.title, songlist.artist ORDER BY songlist.count_requested DESC, songlist.artist DESC LIMIT 30; "; $result=mysql_query($query); $num=mysql_num_rows($result); echo "<ol>\n"; while ($row = mysql_fetch_assoc($result)) { echo "<li> {$row['artist']} - <a href='{$row['songID']}'>{$row['title']}</a> ({$row['count_requested']} ) </li>\n"; } echo "</ol>\n"; ?><br /> thats the code in the page. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource on line 24 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource on line 26 line 24 $num=mysql_num_rows($result); Line 26 while ($row = mysql_fetch_assoc($result)) { thats where i am rright now Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085682 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 You need to check your queries succeed before using there results. At minimum.... if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { echo "<ol>\n"; while ($row = mysql_fetch_assoc($result)) { echo "<li> {$row['artist']} - <a href='{$row['songID']}'>{$row['title']}</a> ({$row['count_requested']} ) </li>\n"; } echo "</ol>\n"; } else { // no results found, handle error. } else { // query failed, handle error. trigger_error(mysql_error()); } ?> always. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085685 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 parse error Parse error: syntax error, unexpected T_ELSE } else { -on that line sorry i am trying to learn but its a slow process Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085687 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 I don't think there are any parse errors in the code I posted. Post your current code. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085705 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 <?php include("dbinfo.inc.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT DISTINCT requestlist.songID, songlist.ID, requestlist.ID, songlist.artist, songlist.title, songlist.count_requested, songlist.composer, requestlist.status FROM radio.requestlist INNER JOIN radio.songlist ON requestlist.songID = songlist.ID WHERE requestlist.status = 'played' GROUP BY requestlist.status, songlist.title, songlist.artist ORDER BY songlist.count_requested DESC, songlist.artist DESC LIMIT 30; "; $result=mysql_query($query); $num=mysql_num_rows($result); if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { echo "<ol>\n"; while ($row = mysql_fetch_assoc($result)) { echo "<li> {$row['artist']} - <a href='{$row['songID']}'>{$row['title']}</a> ({$row['count_requested']} ) </li>\n"; } echo "</ol>\n"; } else { // no results found, handle error. } else { // query failed, handle error. trigger_error(mysql_error()); } ?> and its a parse error Parse error: syntax error, unexpected T_ELSE in on line 34 i took out some of the html above it so yeah // no results found, handle error. } else { line 34 is the else Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085723 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 Sorry, there is a missing } if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { echo "<ol>\n"; while ($row = mysql_fetch_assoc($result)) { echo "<li> {$row['artist']} - <a href='{$row['songID']}'>{$row['title']}</a> ({$row['count_requested']} ) </li>\n"; } echo "</ol>\n"; } else { // no results found, handle error. } } else { // query failed, handle error. trigger_error(mysql_error()); } ?> Also, you can remove those extra calls to mysql_query() and mysql_num_rows() that you have. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085739 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 Notice: SELECT command denied to user thats what i get with that now Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085759 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 Whatever user your using to login to mysql with doesn't have sufficient permissions to execute a SELECT on that db. See http://dev.mysql.com/doc/refman/5.1/en/privilege-system.html Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085761 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 thats what i thought it had to do with. its a remote server not dedicated and they dont have the user permissions in phpmyadmin is there a query to add privledges or is it something the server has to add Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085763 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 Do you have shell access? You cannot execute a query (even to fix the problem) if you don't have sufficient permissions. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085767 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 yeah i had to contact them for them to open a ticket to srt permissions on the database LOL dedicated servers so much better . but thanks i will let you know if it works after that by the way love your blog nice design Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085770 Share on other sites More sharing options...
trq Posted July 14, 2010 Share Posted July 14, 2010 by the way love your blog nice design Thanks, its just some template. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085776 Share on other sites More sharing options...
Vizonz Posted July 14, 2010 Author Share Posted July 14, 2010 i like it stupid server tells me we opened a ticket for are tier 3 team and you will get a responce within 48 hours. 48 hours to check a few things in phpmyadmin. aplus hosting great support team LOL Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1085785 Share on other sites More sharing options...
Vizonz Posted July 15, 2010 Author Share Posted July 15, 2010 Alright they telling me i have access to the database that something is wrong with the coding anyone help me ? Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1086283 Share on other sites More sharing options...
trq Posted July 15, 2010 Share Posted July 15, 2010 Post your current code and error. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1086291 Share on other sites More sharing options...
Vizonz Posted July 15, 2010 Author Share Posted July 15, 2010 sorry wasnt paying attencion its where it was last nothing changed still same thing same error From the server Regarding your issue with database connection, has returned from our investigation. It has been determined that database connection is working properly. We have tested and we were able to access database and run sql query for it (please see connection logs below). Please check code in top30.php. We have now closed the ticket with regards to this issue. If you do require any further assistance, please do not hesitate to contact us and we will be glad continue working with you. Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1086308 Share on other sites More sharing options...
Vizonz Posted July 15, 2010 Author Share Posted July 15, 2010 <?php include("dbinfo.inc.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT DISTINCT requestlist.songID, songlist.ID, requestlist.ID, songlist.artist, songlist.title, songlist.count_requested, songlist.composer, requestlist.status FROM radio.requestlist INNER JOIN radio.songlist ON requestlist.songID = songlist.ID WHERE requestlist.status = 'played' GROUP BY requestlist.status, songlist.title, songlist.artist ORDER BY songlist.count_requested DESC, songlist.artist DESC LIMIT 30; "; $result=mysql_query($query); if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { echo "<ol>\n"; while ($row = mysql_fetch_assoc($result)) { echo "<li> {$row['artist']} - <a href='{$row['songID']}'>{$row['title']}</a> ({$row['count_requested']} ) </li>\n"; } echo "</ol>\n"; } else { // no results found, handle error. } } else { // query failed, handle error. trigger_error(mysql_error()); } ?> theres the code though Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1086311 Share on other sites More sharing options...
Vizonz Posted July 15, 2010 Author Share Posted July 15, 2010 i am an idiot i know why LOL its a new database name i forgot to change it in the query \ where it had radio. in the query was the localhost database i just removed that and it now works. thanks for the help with the actual php though the rest was my stupidity Quote Link to comment https://forums.phpfreaks.com/topic/207680-need-help-moving-scripts-from-local-to-remote/#findComment-1086314 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.