Combining Two Variables Together To Make A New One?

Aug 21, 2007

Supposing I have one variable, $file=filename, and a second variable, which is $number='99'; How can I make a third variable, $fileno which will equal filename99? I'm guessing it's not as simple as $fileno=$file$number...


Combining Multiple Queries To Make One Simple Query.

Dec 27, 2006

I'm trying to combine 3 queries but having difficulties getting the results I want.

the query is:....

View 7 Replies View Related

Combining Session Variables

Nov 30, 2005

Is it possible to combine session variables multiple pages to a single POST in the final formhander?

View 10 Replies View Related

Combining Form Variables

Nov 10, 2006

I have a form on which a user can select a date in one field and a time in another. I need to combine these two variables into a single datetime variable to put in the database. I've looked all over and can't seem to find any good info on this. Everything else I am sending to the database works just fine. Here is what doesn't work [it throws a parser error]:

$db_host = "*****";
$db_user = "*****";
$db_pwd = "*****";
$db_name = "contentdb";

mysql_connect($db_host, $db_user, $db_pwd) or die('Could not connect to mysql server: '. mysql_error());
mysql_select_db($db_name) or die('Could not select database: '. mysql_error());

$publishdatetime = $_GET["publishdate"] + $_GET["publishtime"];

$result = mysql_query("insert into main_articles (publishdatetime) values ('$publishdatetime');


View 2 Replies View Related

Combining Variables In All Combinations

Apr 20, 2005

I am creating an app that will take a 3 lists oy words or phrases (entered in a textarea form element) and produce all combinations of th lists.

For example, if you enter the words
"buy" and "sell" in the first box,

"blue" and "red" in the second box and

"widget" and "widgets in the third box

script would generate all combinations of these words like "buy widget" "buy widgets" "buy red widget" "sell red widget" "buy blue widget" "sell blue widget" "buy red widgets" "sell red widgets" "buy blue widgets" "sell blue widgets"

I think I will turn each list into an array (explode()), and then process, and then take the completed list an implode() back to a variable. I'm just not sure how to process the combinations.

View 1 Replies View Related

Combining A Collection Of Variables Into One Variable.

Mar 29, 2007

I would like to store a collection of variables into one whole variable.

This code below shows drop down boxes, which contain the days, months and years.
I would like to store this information into one variable, how would I do this?

For example if the user selects 02, March, 2007 then I would like this information to be stored into the database. How can I store each value in the seperate drop down lists into one whole variable? Code:

View 3 Replies View Related

Cross-file Variables / Make A Ton Of Permanent, Global Variables That Will Be Valid On Any File On The Current Installation??

May 3, 2011

I have a bunch of database addresses and other random long strings that I must input into functions again and again all over my site. Is there a way to make a ton of permanent, global variables in PHP that will be valid on any file on the current PHP installation?

Or should I just make a vars.php with all of the variables defined, and always include that file?

View 3 Replies View Related

Make The Variables In @include("variables.php") Global?

May 5, 2010

My php script looks something like this. Is there someway to make the variables in variables.php global so that I don't have to read the file with every function?

PHP Code:
// use variables from variables.php

View 5 Replies View Related

Make Variables?

Nov 27, 2005

i have following object:

with 10 fields

can i make call such variables in a cycle? like $vote->answer{$i}+=10; or something like this?

View 1 Replies View Related

Make All Variables GLOBAL

Jan 2, 2002

In functions, is there a way to make every variables global without having to delclare every single one of them in the function?

View 5 Replies View Related

Make A Variable From 2 Or More Variables

Oct 24, 2000

I need to know if there's some way to make a variable from 2 or more variables, but not assignin the value of all of them to another one, just like this way...

$variable1 = $row[1];
$variable2 = $row[3];

and here's my problem (read it as ($variable1$variable2)[$i]):

$variable1 + $variable2 + [$i] = ("something else");

View 1 Replies View Related

Joining Two Variables To Make One?

Jul 20, 2006

Sorry for the rediculously simple question, but my Super-Duper Sam's book doesn't seem to have the answer, and I'm not doing so well at finding it in the php manual.

I'm making a login search script where someone has to enter two characters in one box then a 6 digit number in another box. On the results page, I'm trying to get those two variables to make one: Code:

View 5 Replies View Related

Make All Variables Global?

Dec 15, 2009

Is there a way to make all variables global?

View 3 Replies View Related

Make Two Variables To Alphabet?

Jul 17, 2011

How to make two variables to alphabet?

$variable1 = ace
$variable2 = bd and script makes abcde

View 3 Replies View Related

Make The 2 Array Be Variables First?

Nov 2, 2009

I wanna push 2 arrays, event array and journal array, into the other array, so I can get the all result once. do I need to make the 2 array be variables first?? or just push them into the array directly anyway?

this is what I have now:
Code: [Select]//check out baby's due date
$weeks_expected = 42;
$baby_id = $_SESSION['baby_id'];
$days_expected = $weeks_expected * 7;
$sql = "SELECT SUBDATE(due_date, INTERVAL $days_expected DAY) AS begin_date FROM baby WHERE baby_id = {$baby_id}";


View 4 Replies View Related

Make Classes Remember Their Variables?

Jul 5, 2011

I have this class that manages stuff like registering, logging in, member-only access, general stuff like that. It have a few variables that are accessed throughout the site. However, when I reload or visit another page, it forgets all of the variables and I have to reset them. To do this, I have two session variables called loggedIn and username. If loggedIn is true, I use a function to get all of the info about username and I reset my variables to the info I retrieved. Should I continue on with this or no?

View 3 Replies View Related

Make Only Specific Functions And Variables Available?

Nov 9, 2010

I want to make a programming environment. I will explain it with an example.One programmer will write that code;

<?php definedMetaTags(); ?>

Programmer will save this file and then upload to my system. That file will be executed at server side and then they system will turn generated code back.That definedMetaTags() function will be already written in the system.

View 3 Replies View Related

Use Extract To Make Session Variables?

Nov 8, 2010

Is there a way to use extract to make session variables? If so how would you go about doing it?

View 2 Replies View Related

Make The Loop And Variable Variables Into A Function?

Aug 20, 2010

How can I make the code below into a function?# split the string by string on boundaries formed by the string delimiter will split the value into an array like the example below,

# Array
# (
# [0] => pg_cat_id=1
# [1] => tmp_id=4
# [2] => parent_id=2

View 4 Replies View Related

Make Multiple Pages In A Single Via Variables?

Oct 24, 2010

How do you make multiple pages in a single php via variables?? Because I want my urls to be like mypage.php?id=variable And, I'm sorry if there's already multiple threads on the subject.

View 6 Replies View Related

Get And Edit GET Variables In Order To Make Hyperlinks

Mar 3, 2011

Let's say that I have URL like somefile.php?sort=id&way=desc.

I want to write a function (or use already made one) that would let me add next variables to URL and set which I want to delete.

I thought about something like function editGetVar("$add","$leave") where $add would be array with new variables to add to URL and $leave would be array with variables that must stay in URL.



and I want to delete "buyer" and add "action", then the a href would look like this:

<a href="somefile.php?sort=id&way=desc&action=edit">

View 5 Replies View Related

Make PDOStatement->fetchObject Not Use Non Member Variables?

May 29, 2010

Lets say I have a class like this:

Class User {
var $id
var $name;

And I run a query using PDO in php like so:


If I vardump my user object it has all kinds of other fields in it that I have not defined in the User class. Obviously I could make my query specific so that it only gives me back the fields I need/want. But if I don't want to do that is there any way to make this work the way I want it to? I like the idea of fetchObject, because it's one line of code to create this object and set member variables for me. I just don't want it to set variables I haven't defined in my class.

View 4 Replies View Related

Make $_SESSION Variables A Global In A Function?

May 26, 2007

i'm have a particular function where it creates session variables, yet after using this function i want to immediately use these session variables

now I realize the only way to "use" variables that are made inside of a function is to make the variable a global variable so it can be used outside the function

so i did this:
global $_SESSION['userid'];
global $_SESSION['username'];
global $_SESSION['userlink'];
global $_SESSION['userifnewmsgs'];
global $_SESSION['userrank'];

however there are many instances when !isset($_SESSION) , when the session variables are not already set

i run this function when the sessions are not set and I get this:
Parse error: parse error, unexpected '[', expecting ',' or ';'

what's going on and how can I fix it?

View 1 Replies View Related

Make A Button That Would Pass The Form Variables To Other Page

Jul 25, 2003

here's some code that's at the top of my page, a form later in the page posts the variables back to the same document and then updates the database. How do I make the page so that when the form is submitted it posts the info to the same page and then passes the same variables that were just put into the database to a page named view.php? or another way that would work was if there was a preview button next to the submit button that passed the variables, but the form action is set to PHP_SELF, so how would I make a button that would pass the form variables to view.php and not to itself?

Here's the code PHP Code:

View 14 Replies View Related

Make Global Variables Available To An Included File Within A Function?

Sep 23, 2010

i need to include files within a function, and files use lots of variables defined earlier in the script.
using global is not an option because it is impossible to say which variables will be used in included files.
the only one real solution is to make all global variables accessible in function, something like:

function finc($file)
foreach($GLOBALS as $k=>$v)[code]....

but it won't be good when using lots of files with lots of variables, so is there any better way to do it?

View 3 Replies View Related

Mysqli - Make A Prepared Statement With Variables And Array Elements?

Jun 11, 2011

I know this is just some annoying syntax thing but i just can't get the code below to work.

if($stmt = $link -> prepare("INSERT INTO google_pre_transaction VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?")) {
/* Bind parameters
s - string, b - boolean, i - int, etc */


View 2 Replies View Related

Variables - Make Object Available Within Functions Without Passing Them Or Making Them Global

Apr 19, 2010

This requirement is just for simplicity for developers and beautiful code. I'm building a template system and I really would just like an object variable to simply be there in all functions. Here's some code:

$class = "slideshow";
$function = "basic";
$args = array(...);
return call_user_func($class.'::'.$function, $args);
public static function basic($args) {
echo $librarian; // "Librarian Object"

View 2 Replies View Related

Make Sure The Session Variables Stay Around Until The Browser Window Closes?

Jan 16, 2009

My application uses some session variables that are timing out even though I thought they would not because I've got the following setting in php.ini:

session.cookie_lifetime = 0 The other session settings in php.ini are pretty much set as their defaults. How do I make sure the session variables stay around until the browser window closes?

View 2 Replies View Related

Make Variables ( Generated Dynamically Within A Class ) Usable Elsewhere In The Program?

Jul 4, 2011

I'm writing a program that reads a series of tasks from an XML file and puts them within dynamically generated "task" objects (e.g., task1, task2, task3, task4 etc.). Each taskXX object has properties (task1->name, for example) that are populated by data in the XML file.

My program runs through the XML file and generates a bunch of objects filled with data. However, I can't use those objects in the rest of my program. Why is this the case? I'm pretty sure this has to do with scope but I can't seem to figure it out. Also, I'm not keen on using the global keyword.

Here's some of the code:

// -- CODE INSIDE FILE: class_todos.php -- //
class readTodos {
public function loadAll() {
$counter = 0;
$xml = simplexml_load_file("todos.xml");
foreach($xml->task as $task) {


View 3 Replies View Related

Undefined Variables And Page Script Running (CSS Stipped Out To Make It Smaller)?

Jul 28, 2010

I have been running some tests on PHP Ajax shopping carts and have encountered the following problem[s]-I will deal with the simpler version for now as the 2 I am running [seem] to have the same problem:I have the following page script running (CSS stipped here out to make it smaller):

PHP Code:
include 'jcart/jcart.php';


When this page(store.php)is run locally using MAMP on a Apple Mac i get no error messages and it seems to work fine, however, when uploaded to a windows server and load the page I get the following error messages:

Notice:Undefined index: my-item-id in on line 248.

Notice:Undefined index: my-item-qty in on line 249.

Notice: Undefined index: my-item-price in on line 250.

The uploaded file can be found here:


View 5 Replies View Related

Variables In MySQL - Make A Table In Database With Name As Username (of The Respective User)

Mar 28, 2010

I am stucked while making code in PHP. I actually want to make a table in database with name as username (of the respective user). (table should be formed only when no such table exisit before) I used session to get username and every thing is right except formation of table.

$tabname = $_SESSION['username'];
$s1 = sprintf("select * from '$tabname'" );
$result = mysql_query($s1);
$s2 = "CREATE TABLE '$tabname' (ID int NOT NULL AUTO_INCREMENT, PRIMARY KEY(ID),input varchar(50))";
mysql_query( $s2 );

View 2 Replies View Related

Combining Sql

Nov 7, 2006

I've got a simple sql statement for a database query but I want the records to be limited by and starting from values that change each time. Creating the values in my php is fine ......I have them held in these two variables

$limiter // obviously the limit value
$start_point // obviously the start point

How do I add these to my sql statement?

I've tried doing this but it doesn't work

"SELECT name,words FROM dialogues WHERE conference_id = '$id' LIMIT ".$start_point.", ".$limiter;

Any ideas?

View 1 Replies View Related

Class Variables Reassignment - Make Bar () Method Return "blue"?

Mar 16, 2011

Is it possible to make the following bar() method return "blue"?

class TestClass
public $var1 = "red";
public function foo() //returns red
return $this->var1;
public function bar() //still returns red
$this->var1 = "blue";
return $this->var1;

I know that class properties can't be variables, results of addition, etc. I read about overloading using __set and __get, however that seems to be geared towards totally dynamic properties.

View 2 Replies View Related

Combining Two Arrays

Jul 17, 2002

I want to combine two arrays to form one with the unique elements from the other two. PHP Code:

View 3 Replies View Related

Combining Java And PHP

Mar 21, 2002

I don't know if this is possible but can we use Java to get some information about the website and pass it to PHP to decided on what to do with it?

The reason why I am asking is because I have got some java of which can detect if the user is using frames or not on my website. And change one link if they r or not.

View 2 Replies View Related

Combining 4 PHP Pages Into One...

Jul 20, 2007

i have a whole heap of php pages using the PEAR Excel Spreadsheet writer, each page create's and uploads an Excel file to my server... I was controlling the by Cron jobs, works well...

The only issue is I have 8 files and my host only lets me have 4 cron jobs at any one time... They suggested I combine the pages... Can that be done? Could I make all the files in one page and somehow process each section at a time?

View 3 Replies View Related

Combining Images

Jul 25, 2007

I'm using imagecopy to combine 2 images. One is just a solid colour created by php, the other is a png-24. Basically I want to put the png-24 on top of the solid colour so that it shows through the transparent and translucent parts.

However what happens is the transparency completely overwrites the underlying pixels, so that any page background colour is visible but not the base image. Am I just dreaming? Is this going to be possible? If it can be done with GD can it be done with imagemagick?

//Send a generated image to the browser

function create_image()
//Set the image width and height
$width = 220;
$height = 220;

View 2 Replies View Related

Combining PHP/MySQL

Feb 20, 2005

I want a DHTML menu that gets each link from a MySQL database. There are a few scripts available on line but they all seemed far too complicated to set up. Can anyone recommend a simple script that creates a text-based collapsing tree menu using links stored in a MySQL database?

View 1 Replies View Related

Combining Strings?

Oct 16, 2007

I'm stumbling over been able to combine this into a single string for output. Code:

View 3 Replies View Related

Combining Logins

Jul 12, 2007

I have PHPBB, PHPAuction, OSCommerce and Photopost, all with MySQL... and at this point there are 4 registrations and 4 logins. This is crazy, I want to make it where they only have 1 registration and login but have no idea how to do it.

I found a mod that allowed me to combine the PHPBB and PHPAuction but they have to register in PHPBB first in order for it to work, and then they have to login to PHPBB and then go to PHPAuction for it to work. If they try to go to PHPAuction first it will just reset the login page over and over, with no response.

View 1 Replies View Related

Combining Two Images With GD

Nov 22, 2005

I am wanting to use PHP to combine two images and save the result as a new composite image. I will always be starting with a jpg and then overlay a png (with various levels of opacity).

Firstly, is this possible? I have been looking through and searching Google but can only find third party systems to do this sort of thing, is it possible just with GD2?

View 1 Replies View Related

Combining Arrays

Sep 19, 2006

I have a form that posts information. I'm trying to join the $_POST values into an array all by itself. For example, if I print_r($_POST), I'll get this:

example => Tree
testing => Green
example => Flower
testing=> Red
example => Mountain
testing => Brown
example => Ocean
testing => Blue

I'm trying to figure out how to join these values so that I'll get:

Tree => Green
Flower => Red
Mountain => Brown
Ocean => Blue

I looked at array_merge, but I don't know that this is what I would need to use :/

View 7 Replies View Related

Combining PHP With Javascript

Nov 6, 2005

I'm having problems getting these two to work in concert. I'm trying to create a level of security to a popup I wish to have. The problem is that the var3 and var4 that are put into the URL are not the same as the var3 and var4 sent to the script from the buttons. important code is as follows:

<script language="JavaScript" type="text/JavaScript">
function MM_openBrWindow(theURL,winName,features) { //v2.0,winName,features);
function SubmitIt(a,var3,var4) {
if (a==1){
var1 = document.financials.mmonth.value;
var2 = document.financials.myear.value;
else if(a==2){
var1 = document.financials.qmonth.value;
var2 = document.financials.qyear.value;

View 1 Replies View Related

Combining Url With Variable?

Oct 23, 2009

I want to do define the following variable $url

$url =$link;

where $link is another predefined variable text string e.g. testpage.php But the above doesn't work, how do I correct the syntax?

View 6 Replies View Related

Combining PDO And DAO Pattern?

Jun 4, 2011

How could PHP's PDO feature and the DAO pattern be mixed? Should I have an abstract class that initializes a connection to the database? Can PDO be considered as equivalent to Java's JDBC?

View 2 Replies View Related