GKWelding
Members-
Posts
268 -
Joined
-
Last visited
Everything posted by GKWelding
-
what you will need to be thinking about is caching. I would suggest having a method of finding out when the tables were last updated, maybe an auto field in mysql with a timestamp. You will then query the data and store it, somehow, that's for you to decide what's best. Next time you run the same query, check the timestamp, if no updates since query was last run then use the cached results. If I were you i'd look at creating the array as you suggest, then serialize it, http://php.net/manual/en/function.serialize.php If you need more help with anything then don't hesitate to ask as I'm a team leader on a project that is estimated to have over 1 million active users within the next 6 months and so I've had to become an expert on stuff like this, scalability, very quickly.
-
[SOLVED] Help needed optimizing a PHP page
GKWelding replied to chitchatter's topic in PHP Coding Help
short answer, no, not if you're wanting to display ALL topics on 1 page. however, I would suggest getting rid of the cache file and paginating instead, that way you wont have a cache file that's hours otu of date, you'll have a constantly up to date connection to your DB. -
change to <body> <table width="70%" align="center"> <tr> <td> <h1>My Web Page</h1> </td> </tr> </table> <table width='70%' align="center"> <tr> <td width="13%" valign="top" align="left"> <b> <a href="index1.php?page=home">Home</a><br> <a href="index1.php?page=tutorials">Tutorials</a> </b> </td> <td width="87%" align="left"> <?php if(isset($_GET["page"])) { $page = $_GET["page"]; include($page.".php"); } else { include("home.php"); } ?> </td> </tr> </table> </body>
-
Well if you're setting visible to yes then you will get that error as you've spelt it wrong.... You've spelt it as visbile... Change your code to: <?php require_once("includes/connection.php"); ?> <?php require_once("includes/functions.php"); ?> <?php find_selected_page(); ?> <?php include("includes/header.php"); ?> <table id="structure"> <tr> <td id="navigation"> <?php echo navigation($sel_subject, $sel_page); ?> </td> <td id="page"> <h2>Add Subject</h2> <form action="create_subject.php" method="post"> <p>Subject name: <input type="text" name="menu_name" value="" id="menu_name" /> </p> <p>postion: <select name="position"> <?php $subject_set = get_all_subjects(); $subject_count = mysql_num_rows($subject_set); //$subject_count + 1 because we are adding a subject for($count=1; $count <= $subject_count+1; $count++) { echo "<option value=\"{$count}\">{$count}</option>"; } ?> </select> </p> <p>Visible: <input type="radio" name="visible" value="0" /> No <input type="radio" name="visible" value="1" /> Yes </p> <input type="submit" value="Add subject" /> </form> <br /> <a href="content.php">Cancel</a> </td> </tr> </table> <?php require("includes/footer.php"); ?>
-
serializing objects - loses methods - the point being?
GKWelding replied to glenelkins's topic in PHP Coding Help
no, no if it is across servers as the unserialized object MUST have direct access to the classes it was derived from. -
serializing objects - loses methods - the point being?
GKWelding replied to glenelkins's topic in PHP Coding Help
Sorry, I should expand on ym first point, to have access to the methods again you need to un-serialize the object! -
serializing objects - loses methods - the point being?
GKWelding replied to glenelkins's topic in PHP Coding Help
As long as the unserialized object still has access to the class it was derived from you will have access to the methods associated with that object. The point of serialisation is, in the context I've used it in before, for caching large objects that do not change much over time. Please be aware however, that de-serialization is very slow. Check out the article below for some interesting stuff with objects and serialization. http://www.devshed.com/c/a/PHP/The-Basics-of-Serializing-Objects-in-PHP/1/ -
[SOLVED] Trying to create a simple login function
GKWelding replied to TheJoey's topic in PHP Coding Help
do print_r on all 4 variables within the IF statement, make sure they are what you are expecting. if not then that's your problem. -
[SOLVED] Trying to create a simple login function
GKWelding replied to TheJoey's topic in PHP Coding Help
ok, now change the following section to: $username = trim($array[0]); //user-name $password = trim($array[1]); //password print_r($username); print_r($password); and check that matches what you're typing in to login. -
[SOLVED] Trying to create a simple login function
GKWelding replied to TheJoey's topic in PHP Coding Help
ok, do me a favour, change to the following: $fp = fopen("registrationinfo/info.txt","a+"); $fileData = fread($fp,filesize("registrationinfo/info.txt")); print_r($fileData); fclose($fp); You will get the headers error again but ignore that and paste the printed data to this thread. -
[SOLVED] Trying to create a simple login function
GKWelding replied to TheJoey's topic in PHP Coding Help
however, the headers error is because you're trying to modify header info after an error has been output to the screen. fix the error and the headers error will go. -
[SOLVED] Trying to create a simple login function
GKWelding replied to TheJoey's topic in PHP Coding Help
dammit, my fauly, fclose($file); should be fclose($fp); and read the post stickied at the top of this form for headers already sent. -
How do we implement a search function into our website?
GKWelding replied to resting's topic in PHP Coding Help
if it is database driven and you want to search for info in the database then try this article. http://onlamp.com/pub/a/php/2002/10/24/simplesearchengine.html?page=1 -
How do we implement a search function into our website?
GKWelding replied to resting's topic in PHP Coding Help
more details on your website needed. is it database driven? what are you lookign to search for? -
Try the following. <script type="text/javascript"> function requestforbreak(id,name) { requestbreak(id,name); empid=id; interval = window.setInterval("checkforbreaks();",1000); } function requestbreak(id,name){ http.open('get', '../../queuecenter/include/requestBreak.php?empID='+id+'&agentName='+name); http.onreadystatechange = function(){ if(http.readyState == 4){ var response = http.responseText; document.getElementById('breakreqmsg').innerHTML = ' ' +response+ ''; } } http.send(null); } function checkforbreaks(){ http.open('get', '../../queuecenter/include/breakPending.php?empID='+empid); http.onreadystatechange = function(){ if(http.readyState == 4){ var response = http.responseText; if(response == 'false'){ window.clearInterval(interval); document.getElementById('breakreqmsg').innerHTML ='Done'; } document.getElementById('breakreqmsg').innerHTML = ' ' +response+ ''; } } http.send(null); } </script>
-
Honestly, you can put the JS wherever you like when you're incluyding it in that way (which is also the way I include it in my CI applications), there is no right or wrong way of including jQuery into CI. however, I'm not quite sure what your problem is, are you getting an incorrect value back after the calculation?
-
[SOLVED] Trying to create a simple login function
GKWelding replied to TheJoey's topic in PHP Coding Help
also, can I point out that because you're using a file with the extension .txt if somebody gueses the location and name of this file then they will be able to see all of your usernames/password in their browser in plain text, not very secure at all. you'll need a htaccess file in the same directory with the following in it (Google htaccess): IndexIgnore *.txt -
[SOLVED] Trying to create a simple login function
GKWelding replied to TheJoey's topic in PHP Coding Help
$fp = fopen("registrationinfo/info.txt","a+"); $fileData = fread($fp,filesize("registrationinfo/info.txt")); fclose($file); $array = explode(':', $fileData); mode a means wrtie only, a+ means read/write. -
http://dev.mysql.com/doc/refman/5.0/en/union.html (SELECT * FROM Table1) UNION (SELECT * FROM Table2)
-
You'll want to use the PHP cURL library... http://uk2.php.net/manual/en/ref.curl.php You'll need to use the curl_setopt (http://uk2.php.net/manual/en/function.curl-setopt.php) function after curl_init to allow it to use cookie sessions.
-
How do I get $_FILES['photo'] to pass to AJAX.php file?
GKWelding replied to robertlob's topic in Javascript Help
no separate form needed, just follow the work around and you'll see. -
Ross, With regards to point 1, both the first two points are perfectly acceptable. However, for ease and the fact it's much more flexible, I would bypass the controller and call the model directly returning an array of data to do what you like with. Secondly, I would go down the route of processing ajax requests differently, as if you process them the same then you'll be loading the framework every time when you really don't need to. I hope some of this helps.
-
My function is not working, what am I doing wrong?
GKWelding replied to StefanRSA's topic in Javascript Help
to be honest I'd recommend using jQuery to achieve this! It would be as simple as: var filename = jQuery('#image1').val(); jQuery.post('imagedelete.php', { filename: filename }); You imagedelete.php file would need to be looking for $_POST['filename'], but this is easily changeable... -
see if this sheds some light on it... http://www.phpfreaks.com/forums/index.php/topic,271957.0.html
-
How do I get $_FILES['photo'] to pass to AJAX.php file?
GKWelding replied to robertlob's topic in Javascript Help
you cannot uppload files via AJAX, sorry, you have to do a little work around using an iframe. linked below. http://geekswithblogs.net/rashid/archive/2007/08/01/Create-An-Ajax-Style-File-Upload.aspx