Hi everybody,
I'm using PHP to echo a content stored on my database.
The content is a DIV carrying any type of data.
The problem is that I don't know the ID and I have some problems with these
DIVs if I try to display them more that once.
So, the idea is to modify the DIV id each time I'd like to display them.
Something like this:
<?...
Hi
Say I have an ordinary table in my db like so
----------------------------
| id | username | password |
----------------------------
| 24 | blah | blah |
----------------------------
A primary key is assigned to the id column. Now when I run a Mysql query like this:
SELECT id FROM table WHERE username = 'blah' LIMIT 1
D...
I get this warning in my error logs and wanted to know how to correct this issues in my code.
Warning:
PHP Notice: Undefined property: stdClass::$records in script.php on line 440
Some Code:
// Parse object to get account id's
// The response doesn't have the records attribute sometimes.
$role_arr = getRole($response->records); // ...
I am trying to add a .html suffix at the end of all strings supplied by the user before it is entered into the database. Here's my code so far:
strtolower(str_replace(" ", "_", $postTitle));
The above takes the title of the post the user it trying to make, turns it to lower case, replaces all white spaces with underscores and makes it...
I am trying to extract unix timestamp from mysql and convert it to ISO8601 timestamp. I need it in order to format date into facebook-like(or stack-overflow-like:) '30 minutes ago' instead of displaying the exact date and time. Has anyone dealt with it?
...
I've been assigned a project for a website where users will be allowed to upload video's (using a YouTube API) but more importantly (for me) they will also be allowed to submit video embed codes (from numerous video sites, YouTube, Vimeo, etc. etc.).
Having no experience with allowing users to embed video:
How can I best protect against...
I am working on code re-factoring of configuration file loading part in PHP. Earlier I was using multiple 'ini' files but now I plan to go for single XML file which will be containing all configuration details of the project. Problem is, if somebody wants configuration file in ini or DB or anything else and not the default one (in this c...
I have a class where I'm using __set. Because I don't want it to set just anything, I have an array of approved variables that it checks before it will actually set a class property.
However, on construct, I want the __construct method to set several class properties, some of which are not in the approved list. So when construct happen...
When I am executing following query then its not updating views column by 1 instead sometimes its updating it by 2 or 3. Say currently views count is 24 then after executing this query it becomes 26 or sometimes its 27.
$views = $views + 1;
$_SQL = '';
$_SQL = 'UPDATE videos SET views = '.$views.' WHERE VideoId= "'.$videoid.'";';
@mysql...
Hi,
In ASP.NET if I declare a variable (or object) static (or if I make a singleton) I can have it persist across multiple sessions of multiple users (it it registered in a server scope) so that I don't have to initialize it at every request.
Is there such a feature in PHP? Thanks
...
I have a PHP application using Zend MVC framework. The entry point for every request to the application is in /public/index.php.
I have a Browser class that has functions to check if the user's browser is compatible with application or not.
My dilemma is, index.php is executed for every controller call. So there are chances that this ...
I have a validation function I'm using inside of codeigniter.
function valid_image() {
if ( ($_FILES["file"]["type"] != "image/jpeg") || ($_FILES["file"]["type"] != "image/gif") ) {
$this->form_validation->set_message('valid_image', 'Wrong file type..');
return false;
} else {
return true;
}
With just the "image/jpeg...
Requirement : Should update MySQL database with that of MS Sql Server updates which reside on Linux and Windows hosting on the same web host 1and1. Accessing each other database from either server is not possible on shared hosting, thanks to 1and1's geniuses..
The solution I chose : I want to output all the active listings in a text for...
I'm fairly new to php and was wondering how do I validate the array for the states and where do I place the php code at? I already did the address part but I'm stuck at the states part.
Here is the validation code.
if (isset($_POST['contact_info_submitted'])) { // Handle the form.
$address = mysqli_real_escape_string(htmlentities(...
I am trying to read a html file which is a plain page with nothing but and tags in it. I'm using a function to return what is between each tag . . I can echo this to the page fine, but when I try to insert into the database the information is scattered. Any recommendations?
...
Need to be able to pull Magento products into an external template. Need to be able to get all products data (description, title, attributes, categories, image, etc).
And need to be able to filter by category, attribute and also search on name.
These calls will be made from the same server that the Magento install is on. What's the b...
Hello, I have recently given up on using Visual Studio for Windows editing. See, PHP isn't really important as I have hardly any pages that use it, but in VS, if it smells PHP then it won't treat it as HTML and thus will all be plainly formatted.. so..
I'm looking for some sorta HTML/CSS/PHP editor that is free and multi-platform(so I c...
Hello,
I've run into problems extending the MySQLi class. It won't let me add any properties.
class MySQLii extends MySQLi {
public $database;
public function MySQLii($host, $username, $password, $database){
// Initialize MySQLi
parent::MySQLi($host, $username, $password, $database);
// Save database name
$this->database ...
I get this, when I try to run my PHP.
When I comment out the database execute() method it is going without errors. But this is not helping me a lot. Please Help :-)
...
Hi. I am designing an extension for Joomla that will allow an administrator to upload files and associate them with specific user accounts. To my understanding, writing a custom Joomla component is the best way to achieve this. However, I also want the administrator to be able to insert "dynamic" download links into articles that are con...