-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
what's you new code look like?
-
You need to give each iframe a unique ID, same should go for your div's, but most browsers can work arround that. If you are using a div more than once on a page it should be a class not an id that you call it with. With proper coding you don't need iframes - the div it's self can show content from other pages.
-
So show us the code for your search, give us something to work with.
-
then you could simply catch it in the PHP before it gets to the insert SQL: if($branch == 'A') {$branch = 'D';}
-
Except that your actual query would have nothing to do with producing the dataset that is being sought. And please, visualising a database as a spreadsheet is more damaging than using multiple wildcards in a WHERE clause. Given the simplicity of the query in question the server load is going to be completly insignificant. I am interesed as to how you think that selecting and returning a bigger dataset than is required, then looping through this oversized dataset with with a switch case in php is more efficient than having the initial query produce only the results that are required. Oh, and welcome to the forum by the way
-
I linked to the install instructions in my last post....
-
What does the "&$x = FALSE" mean? & tells the function that it is going to refference a variable, in this case $x, that has been initialised somewhere in the main body of the code, ie. Not within a function. Using the = FALSE then skips looking up the variable and assignes it a boolian value of FALSE. This is just a method of making the function treat the $x variable as an external entity, so that it can then be accessed outside the function. Thorpe's method is cleaner, in that you would process your function as before, and then include a statement that will return $x from the function into the main body of the code, as follws: function Get($col, $row) { $x = ($_GET['x'] + $col); @$worked = mysql_query("SELECT * FROM `map` WHERE `x`=('".$_GET['x']."' + $col) AND `y`=('".$_GET['y']."' + $row)"); @$result = mysql_fetch_object($worked); if($result->x != ""){Map::GetWork($result->Number);} else {Map::GetFail();} return ($x); } Hope that makes sense - and is accurate (not too sure about the refferenceing stuff). You should spend time looking into functions in deapth so that you can get a proper understanding of how they operate.
-
Just an FYI - Instead of concatenating the strings using . here: $model=" model='".$_POST['model']."'"; The following should have the same effect, and can oftentimes be easier to read: $model=" model='{$_POST['model']}'";
-
I don't know how you are inserting your records, without knowing that I can't realy help much.
-
Confused me on first reading, sounded like the OP was asking for a breakdown of each of the 3 counts ie 1x123, 1x321 & 1x213 My mistake, I apologise. Still, I would have used a COUNT() in the SELECT rather than take the mysql_num_rows() from the result. SELECT count(set1) as total FROM sample WHERE set1 LIKE '%1%' AND set1 LIKE '%2%' AND set1 LIKE '%3%'
-
Best approach would be to alter the insert statement if you can, so that no records will be added to 'A'. Other than that, there is no other way that I know of than to run the update periodicaly. You don't "move" records, you only change the data that the records hold.
-
Not exactly like that, no. All that happend was you told the database that "FOR every record in 'table' that has an 'A' in the branch Field change this 'A' to be a 'D'" So it hasn't moved or copied any records, only changed the information that that was stored in the branch column for every one that had an 'A' to begin with. If you now run SELECT COUNT(*) AS branchCount FROM table WHERE branch = 'A' You should get 0 back as the result.
-
wait a minute - are you actualy trying to update a table called "table"?!? because that is a reserved word, you should call it something else.
-
What character encoding have you set in your database? It will need to be something that accepts multi lingual characters as input
-
and how does that come close to producing the desired result set breakdown?
-
You meen you havn't even tried it? change table to property and it looks like it might.
-
Nice find! I Look forward to the day when it supports MS-SQL connectins
-
no need to use a foreach, as a simple simple while loop would do. There really is absoloutly no need to alias the table name. And be carefull with your quotes. $qry = "SELECT user_id FROM urbex_users"; $users = mysql_query($qry) or die("ERROR:<br>Unable to process query -- $qry<br>The following was returned by the server -- ".mysql_error()); while ($user = mysql_fetch_array($users){ $pid = $_GET[post_id]; $in_qry = "INSERT INTO urbex_forum_posts_is_read (post_id,user_id,is_read)VALUES('$pid','$user','0')"; mysql_query($in_qry) or die("ERROR:<br>Unable to process query -- $qry<br>The following was returned by the server -- ".mysql_error()); } The "or die" statements are only there for design stage, and should not be used in a production setting.
-
lol, steady on, I'm actualy a pretty poor coder compared to most of the regulars on here. Just glad I could help. Good luck.
-
No idea, unless you havn't enabled it in your php.ini file http://www.php.net/manual/en/zip.installation.php
-
publicity stunt
-
I would think the best thing to do would be to get the facebook api and see what it offers. I would have to assume it's listed in the users personal details section (as opposed to the open profile pages), and whatever code you write will need express pemission from the facebook user to allow it access ~(otherwise it would be a serious security flaw).
-
ok, tweeked and tested the foreach (I made a totaly stupid mistake with the = ) here's the sample code I used for testing <form method="post" action=""> Select the size you would like<br> <input name="size[]" type="checkbox" value="Small"> Small<br> <input name="size[]" type="checkbox" value="Medium"> Medium<br> <input name="size[]" type="checkbox" value="Large"> Large<br> <input name="send" type="submit" id="send" value="Upload"> </form> <br><br><br><br> <?php if (@$_POST['send']){ $checklist = array(); $checklist = $_POST['size']; foreach ($checklist as $option){ if ($option == 'Small'){ $smallOut = 1; } if ($option == 'Medium'){ $mediumOut = 1; } if ($option == 'Large'){ $largeOut = 1; } } echo 'Checking values:<br>'; echo '<table><tr><th>Small</th><th>Medium</th><th>Large</th></tr>'; echo @"<tr><td>$smallOut</td><td>$mediumOut</td><td>$largeOut</td></tr></table>"; } ?> That works now, standalone. I also took the "<?php echo $_SERVER['PHP_SELF'];?>" out of your form, you don't need it in there, and it's better if it's not.
-
I'm not sure I follow. Do you want one count per day, one count per user, or one count per user per day? None of which really fit with what you are currently using in your where clause.
-
Error during connection to DB2 database
Muddy_Funster replied to patrickoq's topic in PHP Coding Help
@ is simply used to suppress PHP messages. Most comonly it is used for conditional existance checks (eg. if(@$GET_['me']){...}), where PHP will fling up usassigned variable notices. I don't suggest you suppress actual error messages though - log them someplace if you preffer, but don't suppress them. That you were getting the error before your "or die" was being processed may point to an issue that should be addressed, not swept under the carpet.