Gunnar J Posted April 13, 2008 Share Posted April 13, 2008 <?php$file=fopen("variables.php","r+") or exit("Unable to open file!");fwrite;$tempvalue = $samlevel + 1;$samlevel = $tempvaluefclose($file);?> Somethings wrong.. But I dont know what... Link to comment Share on other sites More sharing options...
justsomeguy Posted April 13, 2008 Share Posted April 13, 2008 What's wrong is that you don't know how to debug. There are only 5 lines in that script, you know (at least) one of them is the problem. You need to look at each line and if you don't know what something is doing, look it up on php.net. If you don't know how to use fwrite, look it up. No one here knows everything, when we have a question we look it up. Check each line, make sure you know what it's doing and that it makes sense, and check it for syntax errors. In those 5 lines there are at least 3 errors. Link to comment Share on other sites More sharing options...
jeffman Posted April 13, 2008 Share Posted April 13, 2008 My friend the ninja is correct as usual, even if he does have the social skills of a snail. I'll give you 2 hints. First, built-functions pretty much always require an argument to be passed inside parentheses.2. When you're debugging, a helpful strategy is to "comment out" sections of your code in an attempt to locate the broken line(s). Temporarily echoing a return value can also help. (But only if you actually assign return values to a variable.) Since your code is just 5 lines long, I'd comment out the last four lines and see if line one works or breaks. When you get it working, uncomment line two and do the same. Etc. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 14, 2008 Share Posted April 14, 2008 My friend the ninja is correct as usual, even if he does have the social skills of a snail.That's being generous. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.