-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
Header already sent error message on LIVE server
Muddy_Funster replied to thara's topic in PHP Coding Help
I followed your link and the page loaded a form, nothing about a header error....although there is is a js error, I suspect that's little to do with anything we're discussing. -
this part of the code I posted before : for ($i=0;$i<$lim;$i++){ echo '<input type="text", name="custUrserInput'.$i.'" />' } does what you you are trying. you need to use a custom loop so that you can control the increment within the loop. just change the input type to options for a select: for ($i=0;$i<$lim;$i++){ echo '<option value="custUrserInput'.$i.'">'.$i.'</option>'); }
-
Header already sent error message on LIVE server
Muddy_Funster replied to thara's topic in PHP Coding Help
You are including the header file twice. once near the top of the script, and once again further down. As your code is there it seems to be lines 12 and 71. You could try changing your include() calls to require_once() and see if that helps...also, remove duplicate calls to the file regardless. Let us know if that helps. -
using your idea of passing in the number to the page, you would set up a conditional to check if the value had been posed from the input form, then loop through an input box chearion echo untill you meet the number entered: if(!isset($_POST['noOfInputs']{ //<your normal page code here> ... } else{ $lim = $_POST['noOfInputs']; for ($i=0;$i<$lim;$i++){ echo '<input type="text", name="custUrserInput'.$i.'" />' } } You will obviously need to do your own sense-checking on the input value from the user, but that's the basic idea.
-
because you want to perform the aggregate function on the table before it's joined you need to join to the SELECT statement itself, and no the table directly. SELECT tableone.name, list, your, other, column, names, from, tableone, tempBillTbl.bill FROM tableone INNER JOIN (SELECT name, sum(amt) as bill FROM tabletwo GGROUP BY name) as tempBillTbl) ON (tableone.name = tempBillTbl.name) also, look into prapared statements in PDO, rather than passing in variables directly to the sql string.
-
import csv file into mysql with file path in a textbox
Muddy_Funster replied to iojbr's topic in PHP Coding Help
that's not an error message (it even tells you error => 0) - what you are seeing is, I believe, the content of print_r($_FILES['csv_file']); -
firstly: please use code tags. secondly: what's the actual problem? damn crystal balls bust...
-
I really really hope those aren't the actual email addresses of people (this site is crawlable, so they could be en-route for a lot of spam). Rather than trying to call seperate "scripts" it would be easier to wrap them in functions and call the functions one after another. eg: function sendFirstMail(){ ... <First Mail Code> ... return true; } function sendSeconfMail(){ ... <Second Mail Code> ... return true; } function sendThirdMail(){ ... <Third Mail Code> ... return true; } $firstMail = sendFirstMail(); ($firstMail === true) ? $secondMail = sendSecondMail() : print_r("Something went wrong sending the first mail"); ($secondMail === true) ? $thirdMail = sendThirdMail() : print_r("something went wrong sending the second mail"); ($thirdMail === true) ? print_r("All Mail sent successfully" : print_r("something went wrong sending the third mail"); That is a gross oversimplification, but it should be enough for you to work out how to implement it.
-
Header already sent error message on LIVE server
Muddy_Funster replied to thara's topic in PHP Coding Help
The first thing that jumps to mind is that it's likely something that is being output by the calling script rather than the header script. Looking at the line in the error : _modify_admin_select.inc.php on line 63 I would start by checking those first 62 lines to see if there is anything at all that could be getting output to the page before the header script is being called (including any spurious line breaks outside <php ?> tags and any possible warning/error messages). -
Hi Torrie. Welcome to the forums. *whispers* there's a section of the forum for introductions...
-
Extracting certain categories from database
Muddy_Funster replied to jack28's topic in PHP Coding Help
Switch is pretty much just another way of doing if / elseif / else, assuming you know the ID's that you don't want to display, a simple single if should do. so you could try something like: while($categories->next()) if(($categories->getID() != <first value you don't want to display>) || ($categories->getID() != <other value you don't want to display>)){ <display categories code> } } -
I'm with Psycho, nothing about what you're doing makes me think AJAX. At most iframe's could get the effect you are looking for, but if it's not broken, why fix it?
-
If it was working, and no longer is then it's probably not the code, unless it was changed as well. First place to look is on the hosting servers file system. Check that the php file is in the same folder as the file that is running the xhtml request. Then check that the permissions are right on file and folder. I assume your hosting provider provides php hosting...
-
When you are selecting information from multiple tables you use a JOIN command. This is part of the core functionality of a relational database - you build relations between the tables of data. You really should take the time to learn about this. Looking at your queries there seems to be some fundamental flaws in your table design. can you post up describe's of your tables and detail any fields that relate across tables?
-
yeah, but you'll need to follow the code through all the functions that it processes, so next up is MakeRequestProducts()
-
how to add edit and delete options beside every result ?
Muddy_Funster replied to keloa's topic in PHP Coding Help
your question isn't specific enough. We can't answer accurately without more information of what exactly you would like to do and how you would like it to be done. What I will say though is: Stop suppressing your database interactions and stop using SELECT * -
pretty much none of that code is relevant to filtering the search, or even returning the value list in the first place. From what you have posted it looks like your first point of call should be the JavaScript function UpdateCode() - can you post up the code for that? On a side note - whoever named a button "clickyclickclick" on a production script needs slapped.
-
non AJAX function returns undefined
Muddy_Funster replied to Muddy_Funster's topic in Javascript Help
Thanks kick, that's done the trick. My confusion came from the data being accurate going into each of the functions, because I was passing it in as parameters, but without the returns that you pointed out, it was never being released from the functions in a usable way. My major mistake was thinking that the only point I needed to return the data was when I was breaking out of the functions altogether, rather than treating each function as needing to return the data independently. Thanks for the insight kicken. -
ok guys, I'm a little confuddled about this one. I'm not overly good at js, but have the need to do little bits and pieces here and there. I have tried to create a few functions that should, when run together, recursively check through the given string and replace certain key character combinations and replace them for a specific value, which would be determined by runtime variables in the actual finished script. My problem is that no matter what I try, the function is returning "undefined" rather than the data it has processed. I have a fiddle of this when you can see it in action located here : http://jsfiddle.net/jJBH6/1/ - forgive the alerts, they are my preferred method of debugging. for those link shy, I have posed the offending functions underneath. I would really love if someone could explain why this is not returning the data as expected. function checkHotVar(data) { var cursor = data.indexOf(':{'); alert("special char search result = " + cursor); if (String(cursor) == '-1') { alert("returning ---" + data); return String("bugger me"); } else { return ; validateHotVar(cursor, data); } } function validateHotVar(cuStart, data) { alert("moved into validate function with a starting point of " + cuStart); cuStart = cuStart; var cuEnd = data.indexOf('}', cuStart); if (String(cuEnd) == '-1') { alert("end Marker Not Found"); return data; } else { cuEnd = cuEnd + 1; alert(" end marker found at " + cuEnd); datastring = data; var control = datastring.substring(cuStart, cuEnd); switch (control) { case ":{uid}": var repWith = 1; alert("match found swaping with " + repWith); break; } alert("starting swap function"); doHotSwap(data, control, repWith); } } function doHotSwap(data, rep, wth) { alert("performing swapout process, changing " + rep + " with " + wth); var neData = data.replace(rep, wth); alert("swap performed, data now reads ---\n " + neData + "\n --- going back to check again"); checkHotVar(neData); }
-
it would be more practical if you could let us see the code that deals with the post submit. Is this a forum you have coded your self or an off the shelf solution?
-
how change include path on diffrent select option
Muddy_Funster replied to Abhishekphp's topic in PHP Coding Help
Since you clearly cant be bothered helping yourself what's the point? Josh gave you the link to answer your question, did you read the page? No, or you would have found this : You need to be on a *nix box and have the propper settings and use the propper wrappers, even then the behaviour is different from a local system include using a file path. Now, untill you show some work on your end, like they say on Dragons Den - I'm out. -
use a query with DATE_SUB() to get the relivant emails, and then build an array with what comes back, implode() the array into a list of addresses, set your address as the to address and BCC the list of other relevant people. You can then send yourself a second message if you need to that contains the information about who else got the message.
-
I can not find the match; please advice me.
Muddy_Funster replied to Jayram121's topic in PHP Coding Help
You will need to explode each array value on the pipe delimiter and run through that for a match, something like the following (untested code): $currentUserAgent = explode(" ", $_SERVER['HTTP_USER_AGENT']); foreach($phoneDevices as $manufact=>$agentList){ $agantArray = explode('|', $agentList); $arrayComp = array_intersect($agentArray, $currentUserAgent); if(count($arrayComp >= 1)){ $yourMan = $manufact; break 1; } } if(!isset($yourMan)){ echo "No match found"; } else{ echo "Match found, you are using a $yourMan device";} -
I love these rants from HoF, Completly unsubstantiated opinionisation floated on a pretext of obtaining perfection. I have to argue that perfect design = most efficient design. whether it uses objects or not. Being able to acertain the benifits of all paradigms in a given scenario and impliment the best one acording to the given case and requirements is far closer to design perfection than simply running about the room shouting "object! object! object!" - in my opinion anyway. That may be the definition accoring to your "Bible of the OOP Evangelist", but in actual fact it's nothing more than an opinion. For future refference, if you are seeking deffinitions you should try a dictionary rather than scripture : http://dictionary.reference.com/browse/object-oriented+design object-oriented design definition programming (OOD) A design method in which a system is modelled as a collection of cooperating objects and individual objects are treated as instances of a class within a class hierarchy. Four stages can be identified: identify the classes and objects, identify their semantics, identify their relationships and specify class and object interfaces and implementation. Object-oriented design is one of the stages of object-oriented programming. Really? Who knew? You kind of have that backwards given the evolution of high level programming languages over the years. OOP has maintained features that were originaly created by the use of procedural paradigms In a word?? Which one exactly? PHP is not a natively OOP by design. And it shoudn't be anyway. If PHP was an entierly stand alone language like java or C, when the only interaction you need to code for is with other constructs of the same language, then a pure OOP structure is fine and dandy, and if you are running PHP as a stand alone language from the console the same applies. Most people who use PHP, however, use it as a web based scripting language, where the day to day activity of the script is dependant on interacting with multiple non-object languages on various levels. XML, HTML and Javascript are not given to nativly support object transactions, yeah you can use JSON to force objects here and there, but at the end of the day, your just going to have to burst that object appart later on to make it useable. My humble opinion is that you are harming your code, and your reputation, with the "OOP zealot" mantra you have adopted. Turn the Church of OOP audio book down from 11 and try opening your mind a little, or at least expand it a bit more before trying to pass off your ideals as proven fact. Just because you preffer OOP does not meen that every other paradigm is bad.