-
Posts
840 -
Joined
-
Last visited
-
Days Won
1
Everything posted by gristoi
-
none taken mate, end of the day had already typed it and couldnt be arsed clicking cancel lol
-
Sorry, bad habbit of mine, i use the <> to basically say insert here. should be: $header="From: [email protected]\r\n";
-
Could be a memory leak, basically a query, or piece of code logic, you wrote could be causing an issue. For example you caould have a query that incorectly joins two tables and instead of searching 100 records it search 1,000,000 records. The best way to get started at tracking the issue down is to look at using your slow query log ( google it). Secondly look at how to use the mysql EXPLAIN function. this will tell you exactly how many rows of data you query is traversing to get your results. Also look into indexing your tables.
-
what exactly did you try for your header?
-
this works fine on my localhost. Is this upload.php that you have posted?
-
There is a warning tendolla, but the whole point of posting is to give your view and opinion on the subject at hand. regardless if someone has posted 1 min before you.
-
change to: <?php $query_user="SELECT username FROM $tbl_name WHERE mail='$email'"; $query=mysql_query($query_user); $row = mysql_fetch_array($query); $user = $row['username']; ?> and: $header="From: <your email address here>\r\n";
-
1. The '->' symbol is one of the two object operators. It is used for accessing methods and variables from within the object. 2. Frameworks allow you to code within a structured manner. Allowing best practices to be shared between developers. basically If i came into your office and picked up a piece of your work i would have to pick it apart to figure out what you were trying to acomplice. But if you were using a framework ( cake, zend etc) then i would know how the code was structured etc.
-
Errors are not logging to errors.log
gristoi replied to hmdnawaz's topic in PHP Installation and Configuration
your question was that you could not see the error logs for php. I presumed you were looking at the default server error logs. Whereas the php error logs are stored under the apache directory: /var/log/apache/error.log -
I understand that it might be a bit complex for a novice. but the download does come with a ton of example scripts that they can go through. Is just one of many options. my personal preference - nothing better than a steep learning curve lol
-
There is a much better package that i have been using for the past year or so is is called PHPEXCEL : http://phpexcel.codeplex.com/ . This set of classes allows you to do pretty much anything. I used it for formatting and styling multi sheet reports. Adding functions into the cells. Works on pretty much and version of excel doc.
-
you need to group by the userid
-
how do i get only one question and related answer in codeigniter way ?
gristoi replied to linux1880's topic in Frameworks
just manipulate the array in the view: <?php echo $qna[0]['question']. '<br/>'; foreach($qna as $k=>$v){ echo '-' .$v['answer'] . '<br/>'; } ?> this is a guess as to your array structure by the way -
Errors are not logging to errors.log
gristoi replied to hmdnawaz's topic in PHP Installation and Configuration
have a look under /var/log/apache2 ( if you installed php as a module of apache that is) -
var_dump($resultCount); see what that gives you
-
I would say this is the worst way you could possibly do this. Allowing users to add an execute a string is the equivelent of handing them the key to the server. You would have to ensure all privelages for the connection were correct to start. What would stop them from saving a query string such as DROP DATABASE ....... or GRANT PRIVILAGES ......... You would be leaving your server wide open to attack. if you want to give them the ability to run queries then you need to take the control of building the quires out of their hands. One way of doing this is to build a query constructor that gives them that names of the fields they can search and the ability to add parameters that you control. Just an idea
-
Forgot to mention that, TeNDoLLA is right. Check that your query is actually returning anything.
-
it is telling you that your query object is not an object. try this: <?php $sql = "SELECT * FROM user"; $resultCount = mysql_query($sql, $cn) or die(mysql_error($cn)); while ($row= mysql_fetch_object($resultCount)) { if ($row->username == $username) { // rest of code ?>
-
display different result depending on mysql number
gristoi replied to final60's topic in PHP Coding Help
Whay have you got your output above and outside of your query result?????????????????? it should look like this: $status_result2 = array('PENDING','ACCEPTED','DECLINED'); while($row = mysql_fetch_assoc($query)) { $status_result = $row['status']; echo $status_result2[$status_result]; } -
ok, this is going to be a bit difficult without knowing what the ajax is doing: put your code back as it was. Which browser are you using? If its firefox or chrome then install firebug as a plugin and google "debugging ajax with firebug". this basically lets you see the ajax request being sent and what response you actually recieve. Along with any javascript errors that you may recieve
-
try changing your javascript to $(document).ready(function(){ $(".error").hide(); $(".send").click(function(){ var name = $("input#name").val(); if(name == ""){ $("label#name_error").show(); $("input#name").focus(); } var email = $("input#email").val(); if(email == ""){ $("label#email_error").show(); $("input#email").focus(); } var subject = $("input#subject").val(); if(subject == ""){ $("label#subject_error").show(); $("input#subject").focus(); } var textarea = $("textarea#textarea").val(); if(textarea == ""){ $("label#textarea_error").show(); $("input#textarea").focus(); } var dataString = name + email + subject + textarea; $.ajax({ type: "POST", data: dataString, url: "./include/process_contact.php", success: function(response){ alert(response); }else{ alert("there was an issue with the ajax request") } }); }); }); and tell me what happens
-
Warning: Cannot modify header information - headers already sent by
gristoi replied to elgaxton's topic in PHP Coding Help
im sorry, but you will be very hard pushed to get someone to go through over 500 lines of code and fix your errors. I advise you hit google and look at how headers actually work. As i advised, you need to ensure that if you are using a header and calling headers that the two fundemantal rules are - No Whitespace before or after the php tags and nothing can echo out above the header request. good luck -
display different result depending on mysql number
gristoi replied to final60's topic in PHP Coding Help
there are a few ways to acomplish this. first is use an array: $status = array('PENDING','ACCEPTED','DECLINED'); echo '<p>'.$status[$status_result].'</p>; another ( and only if you know the output is a limited amount ) is a switch: $status = array('PENDING','ACCEPTED','DECLINED'); switch($status_result) { case 0: $result = 'PENDING'; break; case 1: $result ='ACCEPTED'; break; case 2: $result = 'DECLINED'; break; } echo '<p>'.$result .'</p>; personally I would use an array to acomplish this, as you may in the future need to do more dynamic actions with your arrays. -
Warning: Cannot modify header information - headers already sent by
gristoi replied to elgaxton's topic in PHP Coding Help
you cannot have anything echoing out above a header request. which unfortunately you have in abundance.