-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
[SOLVED] PHP code not fetching all values from mysql db
mikesta707 replied to snorky's topic in PHP Coding Help
try mysql_fetch_assoc instead of mysql_fetch_array -
thats because you have no echo statements in your code... or at least not any that I can see
-
Problem Looping to Write Multiple Web Pages
mikesta707 replied to silveradogirl45's topic in PHP Coding Help
alright so what is happening when you run your code, and what do you expect to happen -
is that output what you expect?
-
manrows is an array, not an object, and you are treating it as an object in the second foreach $deduct = $row->deductible; should probably be something like $deduct = $row['deductible']; assuming that $row is an associative array
-
Having trouble with the SUM of selected rows in table
mikesta707 replied to bajangerry's topic in PHP Coding Help
$row is an array, not an object. So you can't use the -> symbol to choose data. also, you probably want the php to return an associative array. Also, the sum will be total, not amt (I think, i could be wrong) $amt = mysql_query("SELECT SUM(amt) AS total FROM provider WHERE day = '01' AND month = '06'"); $row =mysql_fetch_assoc($amt); $total = $row['total'];//if doesnt work try $row['amt']; echo $total; that should work. Hope that helps! -
you can style the links with php if you want...
-
You have to close the PHP tags to do what you want. Also, you don't need to write "endifelse;" if you have opening and closing brackets. <?php if ($ip == "255.255.255.255") { echo "Your IP Is Blocked!"; } else { ?> <script type="text/javascript"> <!-- my javascript code --> </script> <?php } ?> hope that helps!
-
when do you do print_r. if its after the foreach then the variables will have been overwritten each time the foreach runs, and will only have the results from the last entry in the array
-
[SOLVED] Trouble with 3rd party PHP script
mikesta707 replied to Jago6060's topic in PHP Coding Help
interesting. I'm not sure if PHP has support for nested funtions. That might be your problem. I just tried a simple example on my server with a nested function. the code was: <?php function tacos ($taco){ echo $taco; insite($taco . "to"); function insite($poop){ echo $poop; } } tacos("hello"); ?> the output was: hello Fatal error: Call to undefined function insite() in C:\Server\htdocs\text.php on line 5 so I think your nested functions is the problem -
when you use a foreach loop, you refer to each entry in the variable as the value variable you use. so instead of using $_SESSION['states'] in your code, you have to use $value. so: foreach($_SESSION['states'] as $key=>$value) { $stateName = explode("-",$value); echo $stateName[0].' <br />'; } echo "</blockquote>"; should work for what you're doing
-
im assuming that the results returned you are talking about are stored in the variable $prem? that seems to be the only variable that gets any data stored after the initial query in the first foreach loop. if that is true, than that is your problem. You will need to store the data from each loop in an array. The variable will get overwritten with new data every time until the last iteration, and that is why the data from the last entry in the array is the only data you are seeing.
-
[SOLVED] Trouble with 3rd party PHP script
mikesta707 replied to Jago6060's topic in PHP Coding Help
looks like its a simple syntax error. delete the space between the function name (request) and the parentheses. public function request($tableorsql, $crit="") { hope that helps EDIT: Nevermind, just tested a simple function and a space between the function name and parameter list is allowed -
No one is going to do your project for you, or explain how you are supposed to do your project. That is up to you. I read some of that sheet, and it seems like you were supposed to be doing this project for a while. But i didn't read all of it, so i'm not sure. If you have a PHP related problem with some code you have, I would be glad to help, but unless you want to pay me to do this project for you, i'm afraid I can't help you
-
ok, so exactly how many times does your foreach run. it should be 3 times right? is it running 3 times, 2 times, once? What happens when it runs, and what do you expect to happen?
-
[SOLVED] MySQL throws an error on a simple query...
mikesta707 replied to mattal999's topic in MySQL Help
forgot a comma. mysql_query('UPDATE imuzic_mp3 SET valid=\'-2\', last_checked=\''.date('Y-m-d H:i:s').'\', check_now=check_now+1 WHERE id=\''.$mp3['id'].'\'') or die(mysql_error()); -
Editting and creating functions in PHP for a Poker game
mikesta707 replied to Senor Ramos's topic in PHP Coding Help
well firstly, that is syntactically incorrect. you have an else statement that isn't connected to an if statement. (also, you can enclose your code in code tags to make it easier to read in the future.) this part is wrong: //you need an if statement above the else statement {//this is wrong else //you need a opening bracket here ##{ $raise = $userbet; $pcash = $pcash - $userbet; } $pot += $raise; I am not sure what if statement you would need connected to that part, becaue I don't really know how poker works, and small blind rounds make no sense to me. Hope that helps! I'll be leaving work soon, so I wont be online for the rest of the night. Good luck, and if you can't get any more help you can email me -
eregi is regex. if you want to detect just the word hi or hello something like $patternHi = "/^hi$/"; $patternHello = "/^hello$/"; should work (hopefully. haven't done much regex at all, but have done some with javascript, and I don't know how much different, or if there is a difference, between javascript regex and php regex) that will match the word only. now that i think of it, just having the word as the pattern would probably work too. In any case, for regex help, i'm not the one to go to. Hope that helps!
-
you will want to look into RegEx
-
something like that would be very advanced. I think that moneytooth's method is the best so far (well I can't think of a better way) You could probably do some wicked regex and work it out, like for example, taking a bad word, exploding it into its specific chars, and making a regex expression that searches for all those characters with any number of spaces in between each character. and then of course you could expand that to any number of other characters
-
MySql Free Result Error: Something wrong with the code...
mikesta707 replied to Huijari's topic in PHP Coding Help
well firstly, try doing or die("ERROR: " . mysql_error()); whenever you do a mysql query. There is probably a problem with the query, resulting in a return value of false, rather than returning a valid mySQL resource. -
Editting and creating functions in PHP for a Poker game
mikesta707 replied to Senor Ramos's topic in PHP Coding Help
Here is a basic php & forms tutorial: http://www.tizag.com/phpT/forms.php that should get you started. Its really very simple once you get used to what you need to do. Hope that helps!