benn600 Posted June 15, 2008 Share Posted June 15, 2008 I wrote a basic content management system and want to set it up on another server. On my server, it works great. On this other server, I can't get it to function properly. It shows tons of errors. The first errors were that I was not passing values to all function inputs. Is this horrible programming practice? If I create a function with three inputs, sometimes I really only need one input. The quick fix is to add ='' after each input variable, right? So I did that and 80% of the errors disappeared. Now I have some PHP/MySQL errors. Here are a few. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\[...]\siteroot\nunemaker\includes\functions.inc.php on line 68 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\[...]\siteroot\nunemaker\includes\template.inc.php on line 41 I really appreciate any assistance on this! Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/ Share on other sites More sharing options...
wildteen88 Posted June 15, 2008 Share Posted June 15, 2008 That would indicate that there is a problem with your mysql query. Add or die(mysql_error()); after any calls to mysql_query, eg mysql_query('your query') or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-565867 Share on other sites More sharing options...
benn600 Posted June 16, 2008 Author Share Posted June 16, 2008 The first error I see on the page refers to this line in my code: if (!mysql_num_rows($input)) So I changed it, adding the error item: if (! (mysql_num_rows($input) or die(mysql_error())) ) Then I get this error and it dies: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\[...\\includes\functions.inc.php on line 68 Is there a chance the server has older PHP or MySQL? The top line of code is the first line of code in the offending function. The function is: function badPageExit($input='') I added ='' on all my inputs everywhere because the php.ini file must be configured differently from mine as my server allows this less strict programming style. Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-566238 Share on other sites More sharing options...
PFMaBiSmAd Posted June 16, 2008 Share Posted June 16, 2008 wildteen88 mentioned mysql_query at least three times in his post. The code sample he posted even showed what you should do. Please re-read his post a few more times. Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-566242 Share on other sites More sharing options...
benn600 Posted June 16, 2008 Author Share Posted June 16, 2008 Yes, but I have die in my select queries...all of them. I use this function to handle all my select queries. function handleSelect($q='',$test='') { handleTest($q,$test); $queryResult = mysql_query($q) or die(mysql_error()); if (mysql_num_rows($queryResult) > 0) return $queryResult; else return 0; } Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-566247 Share on other sites More sharing options...
fenway Posted June 16, 2008 Share Posted June 16, 2008 Then that code isn't working or you're not calling it. Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-566445 Share on other sites More sharing options...
benn600 Posted June 17, 2008 Author Share Posted June 17, 2008 I solved the problem by removing some logic: if (mysql_num_rows($queryResult) > 0) return $queryResult; else return 0; changed to just return $queryResult; Now my photo gallery upload is having some trouble. I'm seeing these errors after trying to upload a picture: Warning: move_uploaded_file(c:\[...]\gallery\full\14.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\[...]\includes\functions.inc.php on line 635 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'c:\php5\uploadtemp\php5323.tmp' to 'c:\[...]\gallery\full\14.jpg' in C:\[...]\includes\functions.inc.php on line 635 I tried chmoding the folders but they are already 666 (read and write (no execute)). Would this work? But when I tried 777 it didn't take. Of course this is probably something to do with my host. What do you suggest? Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-567370 Share on other sites More sharing options...
fenway Posted June 17, 2008 Share Posted June 17, 2008 Not sure, this is a PHP-related issue now (file host permissions, not mysql, at least), so I'm moving it to the appropriate forum. Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-567445 Share on other sites More sharing options...
benn600 Posted June 17, 2008 Author Share Posted June 17, 2008 Makes sense. Sorry for the sudden topic change. But any ideas anyone? Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-567582 Share on other sites More sharing options...
benn600 Posted June 19, 2008 Author Share Posted June 19, 2008 Problem solved. I tried chmod-ing as I should in FTP but it didn't take. Assuming it was my mistake, I posted unsure. Well, after contacting my host, they told me I have to chmod through the web admin interface. Doing so solved the problem. Thanks for reading! Quote Link to comment https://forums.phpfreaks.com/topic/110266-my-software-on-different-phpini-settings/#findComment-568781 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.