In the middle of a period of big refactorings at work, I wish to introduce stdClass * as a way to return data from functions and I'm trying to find non-subjectives arguments to support my decision.
Are there any situations when would it be best to use one instead of the other ??
What benefits would I get to use stdClass instead of arra...
Yes I know global variables is a bad practice, but ease up on that rule for this one :P
My code:
include('something.php'); //where $from is declared
function myfunc() {
global $from;
echo "from(myfunc)=$from<br />";
...
}
echo "from=$from<br />";
myfunc();
The result is:
from=2010-05-01
from(myfunc)=
What's going on?...
I'm currently using WP Shopping Cart.
Per order of a product, I need to attach some meta data such as size, frame options and frame colour. These different options change the price of the end product.
My first idea was to simply add a new product via the database each time, adding the necessary info to the product description and chang...
Can any one please let me know i have uploaded a gif image using move_uploaded_file available in PHP, here my question is...
some of the gif images are uploaded well and some are not why? do i need to add any function to upload those gifs?
...
Scenario:
Two different objects that get their data from a MySQL database (originally, then subsequently from a serialized/unserialized SESSION key) are causing a recursion error for json_encode, but ONLY when another, later INSERT query has failed.
The INSERT query will fail when certain elements are NULL (as mandated by the table str...
<?php
$tab=1;/*$_GET['tab'];*/
$id=1111;/*$_GET['id'];*/
include_once('solve.php');
$query="SELECT
user_job.level1,
user_job.tab_level,
job.money_gain,
job.exp_gain,
job.energy_required,
job.name,job.job_id
FROM user_job
RIGHT JOIN job USING(job_id) WHERE job.tab=".$tab." AND user_job.user_id=".$id." LIMIT 0,10";
$resu...
Hi,
I want to check a row in an mysql table for the username in php, if the username starts with ab to write an text.
the username is in a cell and looks like this: ab_12345453.
Thanks,
Sebastian
EDIT:
thank you all for your reply.
but i need something else.
i need this for joomla, i don't need to make an query, i just use: $user->u...
I'm using TinyMCE editor in my site. I want to learn way of correct filter for my input when i'm inserting to DB. Which filters are need to use? For example i get this input to DB this way;
$example = $_POST['example'];
<textarea name="example"></textarea>
I'm not using htmlscepialchars(); because i need the html tags.
"Sorry for my...
In PHP, IMAP Functions, what are the functions that download the attached files.
I only want to download attached files if needed. I want to save bandwidth, but maybe some functions download them to get their information, or the structure of the email ?
If I have an attachment of 2G, I don't want to download it, but want all the same to ...
Hi. I have an array for all the cars in a online game I'm making that look like this:
$GLOBALS['car_park'] = array (
"Toyota iQ3", "Think City", "Lancia Ypsilon", "Smart fourtwo", "Chevrolet Matiz", "Mazda 2", "Peugeot 107", "Nissan Micra", "Mercedes-Benz 310" /* dårlige biler */
, "Lexus IS-F", "BMW M3 CSL",...
Hi,
I have a .php that contents the body of a text email.
In that body I want to create a link that when the user receives the email can be clicked.
How to create that link?
Regards
Javi
...
Hi all,
I have an ajax request that requests a php script that connects to my server and returns some results
Here is my PHP code:
<?php
require_once 'p/DataBase.class.php';
if (!isset($db)) //i added this if statment incase this caused the error
$db = new DataBase();
$db->query('select * from table where status = 0 order by created...
Hello Experts,
I'm using PHP GD to fetch an image from a remote server.
$res=imagecreatefromJPEG ($url);
I need to have a cookie set with a value along with the call to get the image.
Is this possible with GD?
How would I do that?
Thanks
...
When building a website in Symfony 1.3 my development server refuses to display my custom 404 page.
I have left the config settings as standard, so my error module is the default, as can be seen in my debug toolbar:
sf_error_404_action: error404
sf_error_404_module: default
This request has been forwarded to a 404 error page by the a...
I have this function:
function selectValue($test) {
$connection = dbConnect(HOST, USERNAME, PASSWORD, DATABASE);
$query = "SELECT * FROM table where value = '$test'";
$results = @mysql_query($query, $connection);
$value = mysql_fetch_assoc($results);
}
selectValue('abcde');
echo $value['something'];
This results i...
I am looking for a solution that allows people to submit their vote to the main site via a voting system or banner.
At the moment, I am aware of one solution that works with drigg and drupal, but it requires url redirect or mod_rewite that is not currently available on the clients server.
Is anyone aware of a solution that would allow...
hello
i was looking for a way to combine different mysql queries in a php file so this is my code :
$sql_query = "SELECT b.*,
u.username AS MY_Sender
FROM table_users u,
table_blogs b
WHERE b.reciever = '0'
AND
u.user_id = b.sender
UNION
SELECT b.*,
u2.username AS MY_Recipient
FROM table_users u2,
...
I have used php mail function for sending mail to local mail id's and external mail id's.
using this mail function I am able to send mail to my local mail id's but the mail function is not sending mail to external mail id's. like [email protected]
I have used the following methods to set the SMTP server address.
ini_set("SMTP","net4indi...
I'm trying to use a Web Service using PHP and SOAP. The Web Service is built in .NET and hosted on an ASP server. I'm using the following code to interact with the API but I keep getting an error with parsing WSDL. The PHP UNIX server has an SSL certificate, the web service host also has an SSL certificate and I'm using https to initia...
hi
a have written this code:
<?php
require("../../config.php");
require("../php/funct.php");
try {
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_TABL.';', DB_AUSER, DB_APASS);
}
catch(PDOException $e) {
echo 'Error: ' . $e->getMessage();
}
$idee=unique_id();
$insystem=true;
include('session_check.php');
unset($insystem)...