-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
Use Code Tags. Only Post Relevant Code. Try Searching Before Posting. Read All Stickies In A Forum Section BEFORE Posting.
-
Creating links to pages based on directory contents
Muddy_Funster replied to still_motion's topic in PHP Coding Help
I'll assume that you have been personally tasked with this because of financial restrictions. If that's wrong then you really should stop now and have a look into implimenting a propper WebDAV style section on your site for file/folder management. Anyway, have you looked into the glob() function at all? I think user submitted comment 3 looks like what your talking about. -
Lines of code are the tools we use - without them we can neither build anew nor repare existing works. You need to post your code. You also need to post the errors it is creating. You can't not load a page using PHP, if you want to do that you need to use AJAX. But what you can do is change the way a page loads depending on a number of conditions...
-
Parse error: syntax error, unexpected $end on line 71
Muddy_Funster replied to larka06's topic in PHP Coding Help
let me try this one... I'm pretty sure Kicken is a hella lot better at this kind of thing than you are. What is the point of asking for help if you will not listen to the answer? -
fermac, can you do a mysqldump on your server (specifically the tables that this connects to)? If you can dump your tables that this script connects to then I'll have a bash at recreating the problem - and hopefully getting closer to an answer as well.
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
and how is that code loaded into your update page?
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
and post #9?
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
as well as going back to my post at #9, change the or die statement so it looks like this: or die($updateSQL."<br><br>Caused an error on server, that error was :<br><br>".mysql_error($conDB)."<br><br> when running with a \$newCartQty of $newCartQty");
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
this is not a versioning problem - this is a coding problem. what mac_gyver was saying about the $conDB is that you need to put it inside the parenthesis of the mysql_error($conDB) <-- like that to make sure it is showing the relevent error from the server. what you also need to do is turn on error reporting (to report on all errors) and enable display_errors in order to effictvly debug your code. These should be turned on whenever you are developing any code (be it a new write or changes to an existing script) to make sure everything is running correctly.
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
removing duplicates of pairs of values based on matching keys
Muddy_Funster replied to phdphd's topic in PHP Coding Help
so you don't want to remove duplicate entries from an array, you want to remove duplicate entries from a series of concatenated array strings generated from two completly unconnected array entities. I'll tell you right now - you have designed this wrong. Anyway, here: $array1 = Array('Spain', 'France', 'France', 'France', 'USA'); $array2 = Array('Madrid', 'Paris', 'Paris', 'Bordeaux', 'Boston'); if(count($array1) === count($array2)){ $compArray = array(); $tot = 1; $matches = 0; foreach($array1 as $key =>$val){ $compArray[$key] = $val.$array2[$key]; } $pairedArray = array_unique($compArray); foreach ($compArray as $cK=>$cV){ if(array_key_exists($cK, $pairedArray)){ $tot++; } else{ unset($array1[$cK]); unset($array2[$cK]); $tot++; $matches++; } } echo "Comparison Compete, $matches duplicates found in $tot items."; } -
not really seeing what's going on here, I can only assume errors are not being displayed on the server. Can you show the GetSQLValueString() function decleration? and how it is being attached to your update script?
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
removing duplicates of pairs of values based on matching keys
Muddy_Funster replied to phdphd's topic in PHP Coding Help
Which is actualy exactly what you asked for. -
$updateSQL = sprintf("UPDATE tabCart SET cartQty=%s, cartTotal=%s WHERE Id = %s", GetSQLValueString(@$newCartQty, "int"), GetSQLValueString(@$newCartItemPrice, "double"), GetSQLValueString($cartItemId, "int")); Sorry, it is GetSQLValueString.
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
so that meens that $updateSQL is empty at the time when it is being sent to SQL server - which will get it upset. Remove the @ suppression from all the lines with the GetSqlValString and see what happens
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
no worries, glad I could help.
-
If your not injecting SQL, it's not an SQL injection error, this is most likely a GIGO error - change your update error message to the following and we'll see exactly what's going on with your SQL (just remeber and post it up ). $Result1 = mysql_query($updateSQL, $conDB) or die($updateSQL."<br><br>Caused an error on server, that error was :<br><br>".mysql_error());
- 29 replies
-
- sql injection
- mysql server version
-
(and 1 more)
Tagged with:
-
what's happeing is that the constructor class - called as soon as a new class object is loaded - is loading the lother two classes (Controller and Model) into local parameters $controler and $model. These parameters become instances of the other classes respectivly. so if $view = new Veiw; then $view->$model is an instance of the model class. That's why the View class has access to $text parameter from inside it's self. This is an implementation of a form of dependancy injection. You could imagine it as a form of reverse inheritance (that's not an actual deffinition - just an easy way to visualise the process). Basicly what you do is you have each class object create localised instances of the other classes it needs to have access to in order to operate, rather than the other way around. Analogy (I suck at these, but I'll give it a shot) : If you imagin inheritance as : A supermarket has customers. so the supermarket employes somone to make sure that as every customer walks through the door they are given a trolly/cart, a voucher book, and a bunch of bags to pack there shopping in. Now Dependancy Injection (DI) : Each person that goes to the supermarket to by something has access to, and chooses only what they need from, all of the above and can pick and choose what they themselves need to use from it. So now people who only want a pint of milk don't need to pick up a trolly/cart, and don't need to get any vouchers - since none of the vouchers are for milk, but can still get a bag to pack it in. Instantly you reduce the amount of resources used by customers as only the ones that need to use the trolly/cart, or benefit from using the vouchers are going to take them.
-
look at my post again. the bit below the grey line is my signature - it apears on all posts I make and is not post specific. the bit above the grey line is my response - it is directly in response to your post.
-
That code is a car crash. The problem that relates to your question is two part: part one is due to you not having any conditional checking on the header to load the add record page, and part two is that you have no persistence for your variables moving on from the check record page. I don't even know why you have the add record script on a different page anyway, and even if there was a reason for it I can't think why you would redirect to load it rather than just use an include. I'm not even going to get started on the db transaction stuff.
-
Adding isset() causes database value to be ignored
Muddy_Funster replied to ICYUH8's topic in PHP Coding Help
Cheers Josh, I couldn't remember if it was a left to right or a right to left evaluation on conditionals in PHP. You don't need to maove anything about, just add the extra lines of code arround (hence the "wrap") the existing code starting before and ending after what you have already. -
Adding isset() causes database value to be ignored
Muddy_Funster replied to ICYUH8's topic in PHP Coding Help
if(isset($variable)) is a check all on it's own. it evaluates to true or false. putting that on the left side of a conditional evaluation is pointless. you may be able to work around the problem by simply adding in the isset check as an extra contition for the evaluation you are currently performing, if not wou will need to wrap the whole check inside a seperate if check. try changing your line 16 to the following first and see how it goes : if($settings['set_payment']=='Y' && isset($settings['set_payment'])) { I think it should go that way round (in that if conditionals are parsed in a left to right manner) if you still get the warning try swaping the two sides of the && around and see what happens. Failing that you will need to wrap the whole lot in in initial if(isset($settings['set_payment'])){ //open if isset() if($settings['set_payment'] == "Y"){ // your current if =="Y" ... //code for matching if=="Y" } // close if == "Y" ... //code for not matching the if == "Y" }//close the if isset() -
break it all down for us. What tables do you have, what information do they hold and how are they related to each other.