Jump to content

leeish

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

leeish's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the help.  I never thought to break apart the code like that.  It turns out that with the code written on the site we have a ton of functions that of course use varaibles passed through them from other pages.  Well, a lot of times we run a function without passing the argument through it even though the function is written with it.  For example we have a: [code]function dothis($a) {   if ($a != NULL){     DO THIS   } else {     DO THIS OTHER THING   } } [/code] I didn't write most of the code for the website, but aparently they trying to save their brains and make two functions in one.  I guess it still serves it's purpose but PHP and MYSQL don't like it too much.  My option now is to go through and fix it all, I am guessing recommended, or leave it and supress errors. Breaking apart the code helped me see that I was not passing through an argument which was the $ward_id.  My code was skipping it of course because it didn't find a row to match and went to the second option.  Thanks for the help of breaking apart the code.  It was a big help. Why does my current server not show the errors.  It PHP 5 better at finding them.  The same page on the server with PHP 4 doesn't return any warnings.  Maybe it has different settings and they are turned off?  Thanks anyway...
  2. I have tried both of those.  No go.  The code works correctly, it pulls a nothing.  It should pull nothing.  I don't understand why I get the error.  The only thing I can tell is that there is something turned on in the PHP settings to show lamer errors.
  3. The way we do it on my server is we have an index.php page which runs all of our Posts.  As HuggieBear said you need to include your functions page with in the other pages.  Then have your form Post to your index.php.  On you index.php have something like this... if (isset$_POST['submit']){ $var = $_POST['submit']; checkgroup($var) } On your page of functions you should have your check group function look something like this... function checkgroup($group){ ALL THE CODE YOU WANT...  $group now equals $var from above. } I hope I explained it well.  Good Luck
  4. Throught our website many times we like to check to see if information exists in a table with a piece of code like this... if (mysql_num_rows(mysql_query( "SELECT * FROM extra_logros WHERE date = '$today' AND sector_id = '$sect_id' AND ward_id = $ward_id; ")) < 1) I am checking to see if there is a row in the table that matches the criteria.  If it does not exist then the next line of code creates and if it does exist then obviously I am doing something with the code.  With PHP 4 I am not sure if we had errors off or what, but all went well.  On our new server with PHP 5, the code still works and all the information gets passed, BUT I get a nice little error at the top of the screen that says: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/solomon/lib/Write.php on line 545 Ok, fine I understand that it's mad that the result is NULL I guess, but that's fine with me.  I want it to be NULL.  My qestuion is:  Is there a different way to write the code so I don't get the error? OR Can I turn off the Warnings for situations such as this?  The page works, I just get a little stupid error at the top of the screen. >:(
  5. It appears that PHP 5 is just showing all the mistakes in the code. A lot of the erorrs are just pointing out useless code that doesn't pull bad results but is pointless, and most of which I am taking out.  I guess I should be happy that it's finding all my errors for me so I can clean up the mess.  Thanks for the help anyway.
  6. Well the pages work on one server and not the other.  I still pull the information on the new server though just I get errors where is doesn't pull any, the thing is that where it doesn't pull info I don't want it to.  Example: $count_confirmations = count_confirmations($_SESSION['info']['SectorID']); Sometimes when accessing the page the people have a confirmation that is pulled from my database in the count_confirmations function.  Othertimes they don't have one, and that is fine, I just want the page to check to see if they did.  The web page however, if it runs the functions and finds that there are no confirmations gives me the error, but if there was a confirmation it wouldn't give me the error. Another example: function A If there is no result for function A { Run this command } It gives me an error when I check to see if there is a result for function A.  It's ok if it's NULL, so why the error.
  7. I have what I hope to be a rather simple question.  We have a website here that is running from what I understand php 4.  Everything works perfect of course because all of the code was written in Dreamweaver and being tested of course and works.  We are in the process of setting up a new server which from what I understand is running php 5.  We have not yet set it up to broadcast but we have it accessable on our network.  All of the mysql tables are on the same machine.  Here is the deal, we copied the page over and we are getting a bunch of errors like the folloring: Warning: Invalid argument supplied for foreach() in /usr/local/apache/htdocs/solomon/lib/Db.php on line 1185 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/solomon/lib/Db.php on line 1175 Warning: Invalid argument supplied for foreach() in /usr/local/apache/htdocs/solomon/lib/Db.php on line 1191 I am assuming it is a difference in the code that needs to be changed from PHP 4 to PHP 5.  I have been looking for a list of things that changed between the two versions and I don't find anything.  My question is what is going on here.  In the "not a valid MySQL resource error" everyone seems to say that is it because it's not pulling information.  I know in a few of the pages the code is set for example: if (!mysql_num_rows($result)){ RUN CODE HERE } So I want to check to see if it pulls something and if not do something else... Well I get an error similar to the one above on the line that has the mysql_num_rows line of code.  Are there things that I have to code differently in php 5.  The web site works 100% on the old server, so I know the code is good.  And advice I am lost at where the problem is if there is one...  If you want an example of one check out www.missionvina.com. It appears that it is giving me errors when the information is not there for example.  I have a function: get_info($x); Sometimes I run the function get_info(1) and sometimes I just run it get_info().  Either way i pull info sometimes one way and othertimes I need the argument in ().  These errors I just want to dissappear because I know all of the code works as I need it.  So is there a way to just turn off the errors so they don't show up?  Or do I need to make seperate functions for when I don't want to run the argument for example.  Does my code have to be flawless to run on PHP 5?
×
×
  • 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.