Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. No. At the point you are echoing out the value, the value is 1.
  2. Sounds like a really bad design decision to me. What exactly is in this file? Does it vary in some way by user?
  3. Seems pretty simple to me. First you could always use a trigger. You didn't state what database you were using but I don't know of any that wouldn't give you a simple way of updating the last_class_date for the appropriate ID in table1 using an "insert or after insert" trigger. You could also pretty easily do this in your php code with a 2nd query after the INSERT query. $sth->prepare('INSERT INTO Table2 (Student_ID, ....) VALUES (?, ....)'); $sth->bindParam(1, $student_id, PDO::PARAM_INT); if ($sth->execute()) { $sth->prepare('UPDATE Table1 SET last_class_date = CURDATE() WHERE ID = ?'); $sth->bindParam(1, $student_id, PDO::PARAM_INT); $sth->execute(); }
  4. You have a couple of options. One is to use the heredoc: $link = <<<HERE <img src="graph.php?LOC=$LOC"> HERE; echo $link; Heredocs are great for having large blocks of markup with php variables sprinkled in, but it's not a great fit for this particular problem, especially given your desire for an if-then block. Then there's the use of echo. As Jess pointed out already, you seem a bit confused in the process of escaping the double quotes, and I would not advocate their use when you are trying to output markup that includes double quotes. It's hard to read and update. Just use concatenation: echo '<img src="graph.php?LOC=' . $LOC . '">'; Mixing logic in with markup can make for some really hard to maintain code, and it's far better to seperate your markup into some sort of template/view file, seperate from your logic. The simplest way to do that is to put your markup in a php file and include/require it, at the point you would otherwise be returning it (in other words, after the variables required are setup. So the way I'd advise to handle this would be to have your markup in a php script, and use PHP's ability to drop in and out of HTML, as in your first example. Just mix in alternative syntax for the control structures you need: <h2>Graph may be coming<h2> <p>If there's a graph available you'll see it below</p> <?php if ($LOC): ?> <div class="graph"> <img src="graph.php?LOC=<?= $LOC ?>"> </div> <?php else: ?> <div class="oops"> Sorry the graph is not available for this criteria. </div> <?php endif; ?>
  5. Either of your solutions is. Neither one is non-standard nor inefficient. In the case of #1, it seems you misunderstand the nature of a php script. The fetching occurs between the server and mysql, so there are not multiple "requests". There is a single request (the query criteria) and the server executes the query, fetches the rows, and returns the response (the completed page with table). The approach chosen is often driven by the nature of the client. If the client is heavy on javascript then an ajax call is typically preferred. In terms of pure delivery of the data, xml has a lot of overhead, and many people opt for json instead. Depending on the possible number of results, many people want to implement some sort of pagination. Under the covers this typically depends on use of the mysql LIMIT clause. That way, a search that returns 5000 rows will not have to build a 5k row table before it could display data to the user. Unless you're really talking about pagination, I'm not sure what your efficiency concerns are.
  6. I see a number of date related comparisons in your where clauses, for example: and date_format(tblOM.CreatedOn,'%H') >= '".$StartTime."' " . When you use a function on a column like this, you insure that mysql will NOT use an index.
  7. I'm not able to replicate the issue. See: http://jsfiddle.net/gizmola/3BZqN/ as computermax suggests, a css reset might help. the specific markup and css you provided does not exhibit the issue, so it suggests it would be something that contains the menu.
  8. How are we supposed to help you when you omitted the jquery plugin specifics?
  9. Just to correct your terminology, php has page scope. So only one script runs at a time. The fact that you have other php files which contain code and are included does not make them seperate "runs". With that said there are ways you can build in a tracing facility, using some of the functions requinix indicated, although you can also setup xdebug and profile execution. What is it about specific files that are important? You could include a file that has code that is never executed, or have a script with 100 functions in it, only 2 of which get called. What is it that you are actually trying to determine with this effort and why?
  10. FWIW, wordpress is a Content management system. For the most part, the content is stored in a database. So it's possible that the changes you alluded to were done through the administration system. I don't work with Wordpress, but it's a pretty simple system. Where people often get into trouble is when they hack it, or add a bunch of plugins.
  11. This is simple with any type of database. What have you tried?
  12. Almost all competent technical organizations use some sort of time synchronization, and set all their servers to use UTC. Some of the things you seem to be alluding to are locale based. If you know what the user's locale is, you can take a UTC datetime and convert it relative to their timezone. PHP's datetime object when combined with the timezone object is fully featured in allowing you to convert a UTC datetime to whatever timezone you want. Clearly a clock, should be running on the user's workstation. You could implement a flash, java or javascript based clock that is initialized to a known datetime value (with timezone string) and then display it. With that said, I don't really know (outside of a worldclock type console) what an application of this idea would be.
  13. What global does in php is indicate that the variables inside the function should be references to global variables of the same name. If you change them inside the function, you change the global variable.
  14. phpfreaks is a forum for php developers. I'm not sure what we can do for you, when it appears your problem is that you're over your head with Wordpress configuration and customization.
  15. Waverlymain, Looking at the flailing going on it's pretty clear to me that this thread is going nowhere fast. My expert opinion is that you should engage an expert at this point to get your script up and running. You can post for help like this in our jobs subforum or use any of the many services out there that typically cater to offshore people. What you need to be prepared to do is have all the credentials and access information for your server. Unless there are significant issues with the script you bought, (in which case, we can't help you either), this looks to be a system administration/ configuration problem, and as such, it's not of general interest to the community at large. We run this community to help developers improve their skills, not as a way of providing non-programmer/business owners and way to get access to free technical support and consulting. Please understand that most of the people who answer questions on this forum are professional developers, and it's simply not fair to them to allow a thread like this to continue, as it's against our community guidelines, not to mention excruciating to observe. Someone who knows what they are doing would have this problem sorted out in 15 minutes (assuming they already had all the access they needed).
  16. mod_rewrite rewrites requests. In other words, when people use a browser and type in a url, mod_rewrite can be used to modify that to something different inside Apache. It does not *change the html your script sends back*. If you want your urls to be displayed in a particular format, you must render them in that format.
  17. That error message indicates that the query failed. This does not necessarily mean there's an error in the query. You might also notice that it's a warning. For someone like yourself, there isn't much value in having your error level set to log warnings. It's not like you are going to take action based on php warning you about potential issues you don't understand and aren't going to do anything to change. There are a lot of things that can go wrong when you're first setting up a system that has database connectivity. It could be that the script is not configured correctly to connect to the database (host,username,password). The database name could be wrong, and/or the table that is being referenced in the query could be missing. Any of these issues could make the script produce the warning at that point. My bet, given what little info you've provided, is that the script is not actually making a mysql connection, and thus none of the queries are going to work until you figure that out.
  18. Not really looking at the code you have, it's clear that there are 2 obvious elements to your question: 1. Accept input from a text box How about an html form? Code that up, and have the form post to your crawler script. The phrase will be available in the $_POST superglob 2. Store the results in a database Pick a database... many to choose from including no-sql db's like mongodb. You'll have to design an appropriate schema. It's not clear what the structure should be, or the purpose of storing the data in the first place.
  19. The errors and snippet of code just aren't enough to go on. It certainly appears that the source file is not valid so that when the routines run, you get empty/black images. Something changed probably having to do with permissions. I wouldn't suspect ftp unless the upload system involves ftp.
  20. Your question is far too vague for anyone to answer at this point. I'm not even clear on what point you're trying to make about Sharepoint.
  21. I took a look and things seem to be functioning as expected. It is posting data to a script at /_layout/php/send.php The problem is that for whatever reason, nothing is being returned by this script. It's impossible for someone looking at this from the outside to debug what is actually going on. Typically I'd check error logs and possibly put in some debug statements, but it could be any number of things at this point, none of which seem to be code related.
  22. Your entire document ready function seems to be missing.
  23. That is just some mind boggling code. First of all, how is it that your system runs a login.html with php code in it? Did you configure your system to parse all your html files as php scripts? That certainly is not the default, and unless you made some addhandler configuration, that is certainly one of the many questions your current code brings to mind. I'm guessing that some of the code got mangled when you pasted it, but your config.php comments are not valid php. Certainly this is highly suspect code: if(isset($_COOKIE['username']) || isset($_SESSION['username']) ) { $loggedin = true; so if I have a cookie named username, then I login? That's obviously not what you want. With that said, it appears we're missing code, as you setup a database connection that is never used.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.