When I execute the following in the MySQL console, it works fine:
INSERT INTO videos (embed_code) VALUES ('test code here');
SELECT LAST_INSERT_ID();
But, when I execute the above queries via PHP, the result is empty.
Under the data abstraction, I am using a database access class named DB. This is how I have tried the above queries v...
PHP has include and require_once which are equivalent to JSP's include directive(<%@ include ..%>)
JSP also has a jsp:include which only includes the output from the included file, keeping the included file in a servlet of its own.
I am looking for something similar in PHP, so that the main page's variables and other content don't mess w...
Hello there. Can you help me, please. I was confused to make PHP code about adjusted cosine similarity.
I have build data like this : $data[UserID][ItemID] = Rating
data example :
$data[1][1] = 5;
$data[1][2] = 3;
$data[1][3] = 4;
$data[2][1] = 3;
$data[2][2] = 2;
$data[2][4] = 3;
$data[2][5] = 3;
$data[3][1] = 4;
$data[3][3] = 3;
$d...
Hello,
Recently when i saw google results page, the query and other parameters where passed with # (hash) instead of the usual "?"
Also, in facebook i saw the same thing. This was quite interesting and after a simple search with google, i found the results related to perl and Ruby but no result with PHP.
Is it possible to pass parame...
Hi there, I have a dilemma that just seems beyond my abilities at the moment!
I have a group of connected sortables using the class 'biglist'.
What I want to do is bind #biglist 's sortreceive callback (which is made whenever a list receives an element from another) to take the 'boxnum' value of the element (which signifies which list...
I came across some code recently that used a custom error handler to turn any PHP errors into an generalized application exception. A custom exception handler was also defined that would log the exception if it was within a particular error code range. Example:
class AppException extends Exception
{
}
function error_handler($errno, $e...
Coming from a C/C++ background, I am used to doing my own garbage collection - i.e. freeing resources after using them (i.e. RAII in C++ land).
I find myself unsetting (mostly ORM) variables after using them. Are there any benefits of this habit?
I remeber reading somewhere a while back, that unsetting variables marks them for deletion...
Working in some legacy code, I've run across a ton of Try/Catch statements. Try/Catch isn't something that they taught in my Zend certification classes, and in 10 years I've not worked with another PHP developer who's used it. Does Try/Catch have extra overhead compared to doing if statements? What would make it more or less desirable...
Hi guys,
i have problem with the plugin elastic editor for wordpress themes
the problem is when i try to save the theme, the plug not save it.
and i cant't see it in themes folder.
why is it happen ?
Thanks.
...
Hi,
I wrote some code to automatically track many objects through an 1000+ frame image sequence. The object boundaries and centers are outputted in xml by my algorithm. I am making a website to show off my results and I would like to have a navigable slideshow with the normal play, pause, forward, rewind features. I currently have a ...
Possible Duplicates:
Display possible combinations of string
algorithm that will take numbers or words and find all possible combinations
If I have 3 strings, such as:
"abc def xyz"
And I want to find the max number of combinations I can generate by rearranging these strings, e.g:
abc xyz def
def xyz abc
xyz abc def
e...
I have a URL I would like to look something like http://server/my/action-name
Obviously, I can't have a - in the ControllerName function and an underscore doesn't work. Is this even possible?
...
Hi all,
I'm looking for a way of converting an image so that all non-transparent pixels (those that have alpha != 1) into black and transparent pixels untouched (or converted to white). The closest I got was with the below imagemagick command:
convert <img> -colorspace Gray <out>
However this still gives me some gray colors instead o...
I am responding to an AJAX call by sending it an XML document through PHP echos. In order to form this XML document, I loop through the records of a database. The problem is that the database includes records that have '<' symbols in them. So naturally, the browser throws an error at that particular spot. How can this be fixed?
...
I want to make an email forwarder similar to cPanel's, where I have a database of email addresses, and where they should forward to, and I set a catch-all to pipe to my script.
I have completed this script, however, I would like to make the "To:" field in the header show the address it was sent to, rather than who is was being delivered...
how can i make it so that the tables are case insensitive?
...
I am using a PHP script using dns_get_record (with DNS_ANY) and it is working fine but, is throwing an error on any domain registered with Register.com.
Warning: dns_get_record() [function.dns-get-record]: res_nsend() failed in...
Any ideas on why this would be? Anyone else had this issue?
EDIT:
Been doing some research and it look...
I want to generate a random string of about 5 characters long. I can create it ok, but I'm having trouble checking if it exists in an array (or database in real situation) and creating a new one if it does.
I use a function like this to generate the string:
function rand_string(){
return substr(md5(microtime()), 0, 5);
}
But them...
Hello,
I would like to make a whole word replace using php
Example :
If I have
$text = "Hello hellol hello, Helloz";
and I use
$newtext = str_replace("Hello",'NEW',$text);
The new text should look like
NEW hello1 hello, Helloz
PHP returns
NEW hello1 hello, NEWz
Thanks.
...
I want to change the format of this array to match another one. One was pulled from a database, and the other was made using space delimted user input and then explode();
So here are the arrays I want to change, this is from the database (mysql_fetch_array). It grabs the single field from all rows.
Array
(
[name] => daniel
)
Arr...