php

How do I make my database connection secure?

I'm currently working on a website for my church's college group, and am started to get a little worried about the security of what I'm writing. For instance, I use this function: function dbConnect() { global $dbcon; $dbInfo['server'] = "localhost"; $dbInfo['database'] = "users"; $dbInfo['username'] = "root"; $dbInfo['pas...

PHP: Notice when error_reporting(E_ALL)

When I try to access info that is not presented in xml like so: $someInfo = $element->blabla->cats[0]->src; PHP shows notice like this: Notice: Trying to get property of non-object How would I settle the matter? ...

PHP: Notice when error_reporting(E_ALL)

When I try to access info that is not presented in xml like so: $someInfo = $element->blabla->cats[0]->src; PHP shows notice like this: Notice: Trying to get property of non-object How would I settle the matter? ...

SQL query to pull multiple entries with same user_id

I have a table that contains id, created, user_id. I'm wondering if there is a query that'll return all unique user_ids that have more than one entried created within the last week. I started with: $query = "SELECT distinct user_id FROM task where created >= '" . date("Y-m-d", strtotime("-1 week", strtotime($date))) . " 00:00:00' and c...

Categorising a large mysql result with php while?

I'm using the following to grab my large result set from a mysql db: $discresult = 'SELECT t.id, t.subject, t.topicimage, t.topictype, c.user_id, c.disc_id FROM topics AS t LEFT JOIN collections AS c ON t.id=c.disc_id WHERE c.user_id='.$user_id; $userdiscs = $db->query($discresult) or error('Error.', __FILE__, __LINE__, $db->error()); ...

fileinfo and mime types I've never heard of

I'm not a stranger to mime types but this is strange. Normally, a text file would have been considered to be of text/plain mime but now, after implementing fileinfo, this type of file is now considered to be "text/x-pascal". I'm a little concerned because I need to be sure that I get the correct mime types set before allowing users to up...

how to insert a converted array to mysql? (Php)

I have converted a json data to array but now i wanted to insert it into my database i keep getting Array here is the code for ($i=0; $i<=$checking; $i++) { $catid = $ids[$i]; $catname = $names[$i]; $catapps = $apps[$i]; $caturl = $iconurls[$i]; $query = "INSERT INTO cat VALUES ('".$catid."','".mysql_real_escape_...

CakePHP. Ajax request not working with debug = 0

I am at a loss. I submit a form via Ajax using submitForm: function(element) { $.post( webroot + 'users/settings', $('#AJAXform').serialize(), function() { var option = $('#AJAXform').find('select option:selected'); $j.current.v.updateField(element, option.text()); $j.curre...

validating numbers only and letters only in my textbox

Pleasant day everyone.. i have this java script code in my php file wherein i used this as my validator..for the inputs in different fields in my textbox... my only problem is i don't know how to create a validation that only accepts letters... in my first name and last name field ...looking forward for any assistance thanks have a nice ...

Running a background process on an ecommerce website

Hi, I have programmed in C/C++, but I have no experience in web programming. Someone asked me to help them build a e-commerce website selling a service. I started looking into using PHP/MySQL for building the site. My question is: given that HTTP is stateless, how do we get some background process to trigger so that it may, for instanc...

how to get rid of the url when printing html

I used this code to print the current page: <form> <input type="button" value="Print" onClick="window.print();" /> </form> but when I view it using universal document converter. It has this url in the upper right corner. How do I get rid of it? ...

Only one result out of ten showing in table

Hello, The code below returns the 10 most recent entries to a MySQL database. That's what I want, but I also want it to display the results in an HTML table. Right now, only the most recent result is in a table, a one-row table. The rest of the results are displayed in a jumble of text. How could I get all of the results in a 10-row...

PHP Architecture: How do I do that?

Hi, I need some help understanding internal workings of PHP. Remember, in old days, we used to write TSR (Terminate and stay resident) routines (Pre-windows era)? Once that program is executed, it will stay in memory and can be re-executed by some hot-key (alt- or ctrl- key combination). I want to use similar concept in web server...

Handling a radio button array in php

Hi all, I have a bit of PHP code that is really taking a toll on me. To simplify, I have a table where three of the columns are forign keys (event_type, accommodation_type and public_user). I am dynamically creating a set of radio buttons and I have set the ID attribute on each imput value correctly. $result2 = m...

Twitter mood API

Is there a twitter API that returns mood? I have seen some websites that return the mood of a specific tweet and I want to be able to use an API (or to use some open source code) to get the mood of a tweet, does anyone know if there is an easy way to do that or if there is an already built API for this? ...

Joomla Filter Menu

Hi, I need to display a menu in Joomla and remove 2 items from it. I am very new to Joomla can someone please help me ? Its like displaying all menu items in list except for 2. ...

Best way to time a PHP script

What is the best way to see how long it takes for your PHP script to run? I was thinking something like this: $start_time = time(); //this at the beginning $end_time = time(); //this at the end echo = $end_time-$start_time; What do you all think? But how can I make it into something that is readable to me and make sense to me? ...

How to load mysql data on option html form

I have this option form: <tr> <td><font size="3">Civil Status</td> <td>:</td> <td> <select name="cs" id="cs"> <option>Single</option> <option>Married</option> <option>Widowed</option> </select></td></td> What do I do in order to load it with mysql data, like this one: <td width="23"><font size="3">Sex...

Is there a good Book Resource on modular web application architecture?

I am asking this question because of Zend Framework. I really like it but still the way it offers modularity is not really flexible. For instance a lot of us at first create default and admin module , but in reality it is not reusable. In fact admin should be not a module but some paradigm that takes care of every single module's admi...

Zend_Translate - Zend_Navigation and Routing combination problem!

Hello there, I'm having some difficulties with the combination of Zend_Navigation, Zend_Translate and the routing needed. My site navigation is done through Zend_Navigation based on and XML file. I've now added translation to the site based on Zend_Translate and added to following change of routing to the bootstrap: protected function...