Hello,
My client has a ecommerce website that sells electronics, and there has been situations where a product is sold more times than they have in their inventory. This is because if two users buy a product at the same time when there is only one product left in stock, one session does not finish registering the product as sold out bef...
I have a script that successfully creates thumbnails but they're rendered low quality. Is there something that I can change in the script to make the thumbnails better quality?
function createThumbnail($filename) {
$final_width_of_image = 200;
$path_to_image_directory = 'images/fullsized/';
$path_to_thumbs_directory = 'imag...
Here's the problem:
I have words I entered via a textarea. I put each word in an entry. i.e words are in an array. On the other hand, I got a wordlist, in which words are separated by newline, I put each word in another array, too.
Now I want to check if $words_entered[$i] = any (and which) of the array $wordlist.
Thanks in advance!
...
How would I go about displaying a tooltip when the user hover overs some text / keywords? This body of text is directly retrieved from the database so I am unable to add any span or div tags or title information to these keywords. Is there a way to automatically create tooltips for certain words that are contained in the page?
Please le...
In the Apache log configuration it is possible to specify that the HTTP auth user name should be logged. Most PHP scripts have their own, cookie-based authentication. Is it possible in PHP to provide Apache with a HTTP auth username for logging purposes, even if the authentication is cookie-based? If yes, how would the code look like? If...
Hey,
I have been using .net for the past couple of years, and I like the way you can add controls at any point in the page from anywhere. For example, you can say Head.Controls.add(new LiteralControl("")) even if there is already a body.
Is it possible to do this kind of thing in php? My site is set up so that we have agents, customers...
Hello. I am by no means considered a programmer. The only programming language I some what know is HTML - so be gentle :)
My boss came up to me the other day and asked me if i wanted to learn PHP, so i said sure. He threw me some text books and said here's what i want you to do:
There's a computer running labview that monitors various...
I am trying to output a set of data, and I have, due to my LEFT OUTER JOIN got multiple rows per match.
I'm using a positive look ahead to see if the next row is the same id as the first. However the return from the database class returns an array of objects.
array(7) {
[0]=> object(stdClass)#4 (8) {
...
It is good idea not to hardcode anything that may change in javascript. For example I want to have url generated by php.
I may write
echo "
<script ...>
var anUrl = $urlFromPHP;
</script>";
and then:
<script ...>
// some code
$.ajax({ url: anUrl ... });
</script>";
Is there any better way to do it? Does anybody know if...
I expected the following to work but it doesn't seem to.
<?php
class Patterns
{
public static const EMAIL = "/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix";
public static const INT = "/^\d+$/";
public static const USERNAME = "/^\w+$/";
}
I get syntax error, unexpected T_CONST, expecting T_VARIABLE
...
This a template page in my wordpress (have removed html), it pulls out the posts from my wordpress database. I want to paginate it but have no idea! :(
I wan't to get something like this
<< First Prev 1 2 3 4 Next Last >>
<?php
$postslist = get_posts('numberposts=10&order=ASC');
foreach ($postslist as $p...
How can I convert the following link below using PHP $_SERVER or something similar?
'../members/' . urlencode($user_id) . '/images/thumbs/' . $avatar;
...
I'm try to ascertain an event time from a date template variable in a modx snippet. However that template variable has a date formatter widget in it which, while nicely formatting the date, doesn't output the time of the event.
I know that modx stores dates in unixtime in it's database, is there an easy way to directly access the unixti...
Hi im trying to execute the following PHP code, however im receiving an error. Im passing a reference into the core class, which i want to assign to a variable within the classes scope..
Notice: Array to string conversion
Thanks in advance..
$core = new core($config);
$core->execute();
class core
{
private $config;
pub...
I have a file structure like this
config
config.php
library
data.php
folder
file1.php
libs.inc.php
test1.php
In config file iam including
require_once('libs.inc.php'); and
require_once('./library/data.php');
In file1.php i am including config file using 'require_once('../config/config.php');'
But it showing error in require_...
I am using Zend_Auth for authentication in a web portal.
A normal mySQL "users" table with a login and password column gets queried against, and a user logged in.
However, I have two additional groups of users that I want to authenticate. All three of these user groups have their logon data in other tables. Their data is coming from ex...
We have urls:
http://site.com/movies/posters/ID.html
http://site.com/movies/posters/fixed/ID.html
How do I know if /posters/fixed/ is present in the current url (on opened page)?
Like:
if ("/posters/fixed/" present) {
$match_fixed = true;
}
Thanks.
...
$qry = mysql_query("SELECT test1,test2 FROM ".$table." ORDER BY RAND() LIMIT 6");
$start = new WP_Query('showposts=6&orderby=rand');
if ($start->have_posts()) : while( $start->have_posts() && $rows = mysql_fetch_assoc($qry) ) : $start->the_post();
$test1 = $rows['test1'];
$test2 = $rows['test2'];
...
I was testing a webpage that I designed on my Android 2.1 browser but it complains with the following:
error on line 1 at Column 39: Unsupported encoding ISO8859-1
Is there anyway to solve this problem?
...
Simple question, simple code. This works:
$x = &$_SESSION['foo'];
This does not:
$x = (isset($_SESSION['foo']))?&$_SESSION['foo']:false;
It throws PHP Parse error: syntax error, unexpected '&'. Is it just not possible to pass by reference while using the conditional operator, and why not? Also happens if there's a space between th...