-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
You want the freelance board, this is for people who want help with their own code.
-
Advise please on the best way to sort this:
Muddy_Funster replied to roldahayes's topic in PHP Coding Help
why would you not want to display a data table in an actual table? anyway, just change your echos to use <div><div style="display:inline-block">...</div></div> rather than <tr><td>...</td></tr> (and drop the <table><thead></thead><tbody></tbody></table> tags altogether) -
Persoanly never been a huge fan of zerofill I would suggest SELECT CONCAT(prefix, LPAD(id,5,0)) as custno, ..... But that's a personal thing
-
most welcome. could you please mark as solved?
-
I would expect $result to be an array, try either echo $result[0] for a single value or foreach($result as $row=>$value){ echo $value; } for multiple lines
-
If you need to ask the question the you most like don't need to be doing it. Custom error management is -normaly- used to handle errors with a controlled formatting regardless of the webserver environment. This is particularly helpfull when you have an abstact debuging system in place. Also if error logging is turned off on the server then you still have something that you can work with, although it's more common to hold the error info in a database than a flat file and include an email or other alert that can tell you or A.N Other admin about the issue. As for the nice page versus other options : it's scenario specific. Some times it's more fitting to return end users to the last page they were on and offer them some snippet of info telling them that something happend with the last attempted action and that admin have been informed, other times that's not really practical and you need to scratch the whole process and crash them onto an error page.
-
php runs on the server, so can't interact with client systems directly. You would need some client side code to work that for you.
-
further risks? That. or more specifically When you take controlls away from yourself and give them to lesser mortals then brown material hits rotating blades with startling regularity. Plus, multiply hunderes of thousands of mailboxes, by even just tens of emails a day and then think of how much storage your catch-all address is going to need to operate for 12 months. There is also the fact that every email is held in said catch all, so if it get's hacked....yeah just think about it. Why not tell us what it is you're trying to acomplish with this and we'll see if there isn't something better that could be done.
-
Adding to a variable stored in localStorage
Muddy_Funster replied to _Unique_'s topic in Javascript Help
there are two options to try: you could use the increment operator ++ instead of +1 nextStep = currentStep++; // as increment is exclusivly arithmetic it sould convert the currentStep variable into a number for you or you could parseInt(currentStep) + 1 nextStep = parseInt(currentStep) + 1; // this manualy typecast's your variable into a number, meening that the +1 should behave as expected in this scenrio -
sure function loadNextStep(step){ //declare custom function that takes your step variable as a parameter step = step++; //increment step variable to reflect next step $.ajax({ //initialise jquery ajax request url:"path/to/yourPHPpage.php?step="+step, //set url that the ajax will load data from, passing in the now incremented step variable to process relevent stage of installation type:"get", // set request type to get as we are passing info thrugh the url and are looking to retieave information from the server, not add information to it success: function loadContent(data){ // if the ajax call is successfull perform this function taking the returned data in as a parameter called "data" $.('#idOfDiv').html(data); // use jquery to change the html contents of your chosen container element (normaly a div element) identified by id = "idOfDiv" }, failure: function displayError(e){ // if the ajax request fails perform this function taking the eror info as a parameter called "e" alert(e); //alert the error info } }); } Does that help?
-
what do you meen "Over Write"?
-
so something like the following psudo? WHERE ( ( (Start_Date <= Today OR Early_Date <= Today) OR (Start_Date <= Today AND Early_Date IS NULL) ) AND ( (End_Date >= Today AND Prevent_Date <= Today) OR (End_Date >= Today AND Prevent_Date IS NULL) ) )
-
that's not the correct syntax for mysql if statments. if(condition_Check, action_whenTrue, action_whenFalse) also, if conditionals are part of the SELECT syntax, not the WHERE as far as I know. What I'm having trouble with is trying to work out what your are doing with all that...
-
I use PDO myself, but looking up examples of mysqli->fetch() everything I found shows it being used in conjunction with a while loop, you could try modifying your code to follow that pattern and see if it helps.
-
Verify if the photo exists in database else show a default photo
Muddy_Funster replied to zazu's topic in PHP Coding Help
there are a number of options... 1 - set the default image to be the default value in the databse table, so that if nothing is entered in it will populate the path to your default image and no futher coding is required 2 - assuming the table holds a null record in the event of there not bing a user defined image then change the select statemt to use an ifnull conditional check to return the default path in the event that the resturned value from the database is null. 3 - perform conditional checkes in the php code that checks for the value returned from the database before using it to populate the img src and have it decide which path to load depending on the content of the result. 4 - check the filesystem to see if the path returned from the database exists and then load the defailt image path in the event that the result does not relate to an actual image file in the filesystem. There are probably more, but that's all that jumps to mind at the moment. Which woud you like to try?- 3 replies
-
- database photo
- photo in database
-
(and 2 more)
Tagged with:
-
Calculating Change Denominations w/ classes
Muddy_Funster replied to Inked's topic in PHP Coding Help
Well, at a glance you're still strugling with the scope of variables within methods. Your validatePayed and calculateChange methods are refferencing method specific variables $changeDue, $change, $oneHundred, $fifty etc. and from your parameter devleration it looks like you're actually meening to refference the class parameters of the same name which would require the same $this-> prefix that you use to get the values of the paramter varialbes on the right of the assignments. -
With AJAX you don't need the full page to be refreshed. You can keep the counter in the js variable and load up the content into a div for each step. <script> function loadNextStep(step){ step = step++; $.ajax({ url:"path/to/yourPHPpage.php?step="+step, type:"get", success: function loadContent(data){ $.('#idOfDiv').html(data); }, failure: function displayError(e){ alert(e); } }); } You can do the same for a "previous step" aswell. even calling it in the failure sub-function if you want to. Add to this that you can, as mentioned before, store all form info in the browser storage so you can pre-populate anything that is re-loaded.
-
As it will only be you, and you will - I assume - be able to change the code in the php pages, hardcode the hash of your password in the pages cose and just use that to verify your entered password. Change the stored hash whenever you want to change the password. an example that uses the hash function in my sig: $pwd = $_POST['password']; $pwdHash = makePass($pwd); if($pwdHash == 'String Stored from previously running chosen password through the makePass function'){ //load admin console } else{ //show password failure } obviously the 'String Stored....function' would be the actual hash from running your password through the function, and not a human friendly string like that.
-
Create a hyperlink <a> that has multiple targets
Muddy_Funster replied to ibtreyt's topic in Javascript Help
nope you'll need javascript -
Seriously? if($_SERVER['REQUEST_METHOD'] == "POSTArray"){ //Process POST var's } elseif($_SERVER['REQUEST_METHOD'] == "GETArray"){ //Process GET var's }
-
I can't commit to a prolonged conversation, but if you link me (either here or in a PM) to a download for your actual code pages I'll try and fix it for you (include any database interactions, but not actual credentials)
-
you add the method post to the form element, not the button. Then, as you said, check for $_POST and $_GET in the php. e.g. <form name="sampleForm" id="sampleForm" method="post" action="your.php"> <lablel for="uName">User Name...</label> <input type="text" name="uName" id="uName" placeholder="User Name" /> <label for="pass">Password...</label> <input type="password" name="pass" id="pass" /> <input type="submit" name="submit" value="Login" /> </form> Then php something like: <?php if(!isset($_POST['submit'])){ if(!isset($_GET['variable'])){ echo"You shouldn't just come directly to this page, it needs variables to work"; } else{ //SELECT QUERY CODE GOES HERE } } else{ //POST QUERY CODE GOES HERE }
-
Could you clarify what you are asking here?