Hi, I'm trying to work with PDO class on php but I have some trouble to find the right way to handle errors, I've wrote this code:
<?php
// $connection alreay created on a class which works with similar UPDATE statements
// I've simply added here trim() and PDO::PARAM... data type
$id = 33;
$name = "Mario Bros.";
$url = "http://ninten...
I'm pulling blog posts from a DB. I want to trim the text to a max length of 340 characters.
If the blog post is over 340 characters I want to trim the text to the last full word and add '...' on the end.
E.g.
NOT: In the begin....
BUT: In the ...
...
I use PHP 5.2.9.
To see/log errors, at the beggining of my script I have:
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
ini_set('log_errors', 'On');
ini_set('error_log', $_SERVER['DOCUMENT_ROOT'] . '/php.log');
But when I use the first of the next two lines, my script issue a HTTP 500 error, and nothing is displ...
I have a php array that gets returned from a database, the array contains paths to images that I want o make up the background of my wrapper div in my HTML, I want to be able to add some javascript that will cycle through the array and a set interval show the next image in the array, is this possible, and is it possible to also have some...
I am writing a game server plugin, and writing a web interface to control it. I am considering detouring the GetPacket() function in the game server, and sending custom packets from my web panel and using GetPacket() to interpret them. My only concern is security as obviously I don't want to just send open data out. What can I read up on...
Hello, I'm working with a sequence of queries created with PDO class, in some case, my queries needs the same paramter.
I've created an array used in a foreach statemend which save the data but some var is ouside, can I use both data in one query?
the example:
// $connection is the PDO object;
// $full_data contains:
// $full_data[$i][...
Say I have a 200 character string that contains HTML markup. I want to show a preview of just the first 50 chars. without 'splitting up' the tags. In other words, the fragment should not contain a <b> without a </b>. Any server side processing should be in PHP.
...
I want my error_404.php to show up in my site template views. I have extended the CI_Exceptions class (MY_Exceptions) and overridden the show_404() and show_error() methods. Now what I want to do is be able to load a view file in there. Optimally, I would like to load the _header() and _footer() methods in MY_Controller class. Is thi...
Hi all,
In accessing my database, I have the user fill out a form, and in the target page, the posted values are used in the resulting MySQL query.
$query = mysql_query("SELECT pass FROM database WHERE user='$_POST[user]'");
However, for some reason or another, MySQL doesn't like my using a $_POST variable in the command, and it only...
I had:
in a class implementing Validator:
an $errormessages property
an isCorrect() method
In the isCorrect method, I had:
switch ($type):
case 'email':
isEmailCorrect();
case 'password':
isPasswordCorrect();
case 'x':
isXCorrect();
isEmailCorrect(), isPasswordCorrect() and isXCorrect() had a...
Hello, I am still a newbie.So that being said, my site has a messaging system that allows users to delete their sent messages. Its been discovered that if I erase my messages out of my 'sent' box, it erases the message out of the recipients inbox. I have two ways to delete messages out of your sent mail, 'erase all messages' and one by o...
So I have a vbs script:
Function test2open( sSourceFile, sPDFFile )
Dim wApp ' As Word.Application
Dim wDoc ' As Word.Document
logStream.writeline "inside test2open"
on error resume next
Set wApp = CreateObject("Word.Application")
logStream.writeline Err.Number
Err.Clear
Set wDoc = wApp.Documents.Open("c:\Windows\Temp...
I'm looking for a free PHP tool to send bulk emails.
Something simple but that works: "send from" address, upload a CSV file (email, name), upload an HTML template, insert plain-text version, and SENT! But has to work with large lists.
We have our own already but it's getting very buggy, and we need to send a mass announcement (7~8,000...
On PHP.net I am looking at the Memcache::set function and it has this optional flag to use compression...
Use MEMCACHE_COMPRESSED to store the
item compressed (uses zlib).
$memcache_obj->set('var_key',
'some really big variable',
MEMCACHE_COMPRESSED,
50);
I am curious...
Below is a function I found about a year ago that is supposed to put a lock on a memcache key so you can update it's value without any trouble of 2 request trying to update the key at the same time.
It is pretty basic but I could use a little help in figuring out how to use it 100%. The part I am not sure about is where it passes in ...
I'm baffled by this one... I'm doing a remote widgety type of setup, we'll control both domains so security is not a concern. I'm using jsonp to allow cross domain ajax requests.
The visited site is domain1.com, which inclues:
<script src="domain2.com/file.js"></script>
file.js uses jQuery to make ajax requests:
$.ajax({
url: 'ht...
Someone had changed my .htaccess, and I have removed that.
But I still have phantom pages like this:
http://www.biztalk-training.com/?puqr=usoe
I don't have any 404.php, 404.shtml, or 404.html pages.
I checked CPanel for redirects on 404, and it looked empty (but would have created a 404.shtml if I filled it in).
If I type in some...
I am using the following PHP:
$xml = simplexml_load_file($request_url) or die("url not loading");
I use:
$status = $xml->Response->Status->code;
To check the status of the response. 200 bening everything is ok, carry on.
However if I get a 403 access denied error, how do I catch this in PHP so I can return a user friendly warning?...
I have a list of data that needs to be processed. The way it works right now is this:
A user clicks a process button.
The PHP code takes the first item that needs to be processed, takes 15-25 secs to process it, moves on to the next item, and so on.
This takes way too long. What I'd like instead is that:
The user clicks the proces...
I'd like to get the Google page rank of a url in my PHP code. How can this be done?
...