39,323 Topics

Member Avatar for
Member Avatar for kutchbhi

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 …

Member Avatar for pritaeas
0
262
Member Avatar for martymaven

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)) …

Member Avatar for karthik_ppts
0
119
Member Avatar for Kognition

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 …

Member Avatar for Kognition
0
109
Member Avatar for gopi17

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 …

Member Avatar for gopi17
0
144
Member Avatar for webwiz

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; …

Member Avatar for webwiz
0
1K
Member Avatar for anthonyjpv

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 = …

Member Avatar for anthonyjpv
0
220
Member Avatar for showman13

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 …

Member Avatar for showman13
0
293
Member Avatar for infinitus

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 …

Member Avatar for infinitus
0
231
Member Avatar for cr7489

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 …

Member Avatar for diafol
0
229
Member Avatar for scarcella

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 …

Member Avatar for scarcella
0
84
Member Avatar for eduard77

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 …

Member Avatar for eduard77
0
137
Member Avatar for Waldema

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 …

Member Avatar for Waldema
0
87
Member Avatar for blabspot

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 = …

Member Avatar for iamthwee
0
303
Member Avatar for praveenphp

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.

Member Avatar for pritaeas
0
101
Member Avatar for spowel4

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, …

Member Avatar for spowel4
0
6K
Member Avatar for Robert1995

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 …

Member Avatar for iamthwee
0
65
Member Avatar for Danny159

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

Member Avatar for Danny159
0
107
Member Avatar for scarcella

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' ); ); …

Member Avatar for scarcella
0
210
Member Avatar for breakforce

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 …

Member Avatar for pritaeas
0
108
Member Avatar for danfel

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 …

Member Avatar for pritaeas
0
99
Member Avatar for andsonlhs

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 …

Member Avatar for pritaeas
-1
238
Member Avatar for anthonyjpv

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 …

Member Avatar for diafol
0
369
Member Avatar for anthonyjpv

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 …

Member Avatar for anthonyjpv
0
94
Member Avatar for yanwick

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 …

Member Avatar for diafol
0
863
Member Avatar for extjac

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 …

Member Avatar for pritaeas
0
160
Member Avatar for Karlwakim

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 …

Member Avatar for scarcella
0
145
Member Avatar for RobotFX

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 …

0
94
Member Avatar for dschuett

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 = …

Member Avatar for dschuett
0
141
Member Avatar for filipgothic

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 …

Member Avatar for iamthwee
0
187
Member Avatar for klemme

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 …

Member Avatar for klemme
0
115

The End.