39,323 Topics
| |
This is the project I am reading from . [url]https://github.com/sasatomislav/PHP5-OOP-Cart[/url] [CODE] class Cart { <snip> private function __construct() {} /** * Fetch Cart instance * * @return Cart */ public function getInstance() { if (NULL === self::$_instance) { self::$_instance = new self; } return self::$_instance; } } <snip> // initialize … | |
I want to select records from my table which have a date which is older than 200 days. The following code calculates that date and displays it on the page as '2011-08-10': [CODE] $todayDate = date("Y-m-d");// current date echo "Today: ".$todayDate."<br>"; //Subtract 200 days from today $rptdate = strtotime(date("Y-m-d", strtotime($todayDate)) … | |
This is boggling my mind. I wrote a quick auto-loader and it appears to work like it is supposed to, except that it keeps changing the argument $class from the class name to "self". Here is the code (followed by further information on what I've tried): [CODE] public static function … | |
Hello all, Guys need some advise and some help regarding displaying data from database... so, basically this is what i'm trying to do, have a keyword (invoice_no)...i'm suppose to search the database, and the find record...the display the remaining attributes (document_no,pallet_no and so on) invoice.php [CODE] <FORM ACTION=".php" METHOD=get> <h1>Enter … | |
I have a strange problem with testing file_exists. When I hardcode the file name 007-PCSafety.zip file_exists works fine but when I post the filename 007-PCSafety.zip it doesn't recognise the file exists. here's the code. I'm swapping the $p variable to test. [CODE=php] if($_POST){ $url = $_POST['dl']; $filename = basename($url).PHP_EOL; $p=$filename; … | |
Im trying to swap the values if taken already but its not working heres the code: [CODE]<?php ob_start(); require_once("../session.php"); require_once("../functions.php"); require_once("../../includes/connection.php"); include_once("../../includes/header.php"); confirm_logged_in(); if(isset($_GET['cat_id'])) { $category_id = $_GET['cat_id']; $result = get_specific_category($category_id); while($row = mysql_fetch_array($result)) { $category_name = $row['category_name']; $position = $row['position']; $visible = $row['visible']; } } if(isset($_POST['Submit'])) { $errors = … | |
I know I should know the answer to this, but I'm drawing a blank... I have a conditional statement that checks for the value of a variable, and if it isn't 'Y', then it does a redirect using the header statement. apparently something that I did a couple days ago … | |
Hello guys ;) Im quite new to PHP and i run into a problem. I was given a PHP task to do and its got to be submited by 27th this month in my uni... unfortunately i was not attending any Web programming class as i was so into Java … | |
i have 2 methods to check if words appear within a piece of text, the method only checks for a word once but i want it to check more than once [CODE] while ($pos_words = mysql_fetch_assoc($pos)) { if (strpos($review_text, $pos_words['word']) !== FALSE) { $good++; } } //Get negative words and … | |
Hi all, I have just coded this for my website, is there a way to improve this either by extending for a more general use or just improving my logic's. Thank you in advance. [CODE] function removeEmptyArray($array, $remove_null_number = true) { $new_array = array(); $null_exceptions = array(); foreach ($array as … | |
I am having a script that starts like this require_once "XML/RSS.php"; In the ini.php the path is set to "include_path = ".;d:\phpincludes" where I have an XML folder that contains the RSS.php file When I try to run it I keep on receiving the error Warning: require_once(XML/RSS.php) [function.require-once]: failed to … | |
Hi! I've been thinking about how to get this idea work: I have a table in my page. Four columns and several rows. Columns are (1) a product name, (2) how many needs to be purchaced, (3) how many already have been purchased and (4) a submit button which should … | |
Well this is my register form, it all worked fine before but for some reason it isn't inserting anything into the table, all of my other scripts that insert items into a table. A quick reply would be nice :) thank you. Here is the Register Script: [CODE]<?php $title = … | |
Hi.... I am using XAMPP for localdevelopment.And I am using the mail() function for sending the mail. But unfortunately it wont sent the mail.I am not using any SMTP server in local host.If I need to sent mail what can I do? Thanks in advance. | |
I know this has been asked many times before so I apologize but here's the php file that's generating the error on the "if($stmt = $this->conn->prepare($query))" line: [CODE]<?php require_once 'includes/constants.php'; class Mssql { private $conn; function __construct() { $dbServer = DB_SERVER; $dbName = DB_NAME; $conn = new PDO( "sqlsrv:Server=$dbServer;Database=$dbName", NULL, … | |
Hello, I have a problem :), like everybody else here :P. Ok so I need to update a wordpress plugin from 2.5 to 3.3.Did anybody else had to do something similar ? Any tips are welcome. Also books about wordpress plugin development would help a lot :).Worth to mention that … | |
Hey guys, How would I work out the date range for the current week...? Then +1 week or +2 weeks time... I hope you understand... So... This week... 20.02.2012 26.02.2012 +1 week will be 27.02.2012 04.03.2012 I will set an offset url variable Thanks Dan | |
Hi everyone, I am wanting to know if there is such a thing like the mySQL SELECT WHERE but in array's. I have this array: [CODE]<?php $array = array( [1] = array( ['test'] = '1', ['test2'] = '2' ); [2] = array( ['test'] = '4', ['test2'] = '2' ); ); … | |
I want to do in the following way, i would be very grateful if you help a little ... Currently my way - from /first page / 1-7 ... 50/last page / 7 when i clicked appears in the following way photo 2, and i want when clicked on 7 … | |
Hello everyone.. i need help for my project.. im using PHP and MYSQL.. i have an exam in my project where one question is displayed at a time.. the user gets to proceed to another question if he/she gets the right answer for the current question.. otherwise, he/she will be … | |
Can anyone help me why unable to upload video and pdf file to the folder? <?php $DBConnect = @mysqli_connect("localhost", "root", "") Or die("<p>Unable to connect to the database server.</p>" . "<p>Error code " . mysqli_connect_errno() . ": " . mysqli_connect_error()) . "</p>"; $DBName = "educationtime"; if (!@mysqli_select_db($DBConnect, $DBName)) { $SQLstring … | |
Hi, I have a pretty quick question regarding PHP code if script is hidden from client's browser and php code are rendered back as HTML to the user is there a way ever that someone can view your code using say a browser plugin? or getting your source file and … | |
Hi! I dont know if this possible I have a payments table in a database what I want to accomplish is, once a certain customer id has paid say $100 USD my discounts table will generate a code for me automatically say I'll insert a new record is there such … | |
Hi, I'm new to JQuery/Ajax with PHP. I'm calling a PHP file, and all the code runs well, except for the echo's. The echo's are not showing and they were supposed to be showing . Here are both my files(Which are very simple): (x.php(main file) and sugere.php(the called file)) X.PHP … | |
hello, i was wondering if someone can explain me what the difference is between the following classes. I found class B nicer to use, but i want to have your comments..... [code] class A { public function setField($var) { $this->anyfield = $var; } } //this is how i use it … | |
Hello everybody, i learned the basics of php a while ago, and as a first project, i want to create a website where anybody can rate pictures or upload his own. The hosting isnt a problem, i want to know if a db is necessary, if its i will have … | |
Hi, I have a complicated (for me) question and it is driving crazy... I just can't find the issue. Basically I'm trying to enable the browser cache for a certain php file. I'm using a script called osdate but don't have much success getting help on their forum. To explain … | |
I have been doing some research on how to go about using a random salt per user's password. There are a few things that I am still unsure about. It is easy enough to store a random hash using something as the following: [CODE] <?php $password = 'MySuperSectretPassword!'; $salt = … | |
I need dropdown menu with this options, just each of them have to show data from base where is = location [CODE]<p>Mesna zajednica <select name="mesto"> <option value="donji_grad">Donji Grad</option> <option value="karadjordjev_dud">Karadjordjev Dud</option> <option value="plavinac">Plavinac</option> <option value="seone">Seone</option> <option value="ladna_voda">Ladna Voda</option> <option value="lestar">Lestar</option> <option value="zlatno_brdo">Zlatno Brdo</option> <option value="slavija">Slavija</option> <option value="papazovac">Papazovac</option> <option value="carina">Carina</option> <option … | |
Hi all, How can I make this nonsens i have written work? I have 2 tables, one containing the urls I need to echo out in links - But I am not echoing out all of them. First I have to check in another table if there are any products … |
The End.