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...

View 4 Replies


Combining Multiple Queries To Make One Simple Query.

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

the query is:....

View 7 Replies

Combining Session Variables

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

View 10 Replies

Combining Form Variables

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

Combining Variables In All Combinations

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

Combining A Collection Of Variables Into One Variable.

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

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

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

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

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

Make Variables?

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

Make All Variables GLOBAL

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

Make A Variable From 2 Or More Variables

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

Joining Two Variables To Make One?

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

Make All Variables Global?

Is there a way to make all variables global?

View 3 Replies

Make Two Variables To Alphabet?

How to make two variables to alphabet?

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

View 3 Replies

Make The 2 Array Be Variables First?

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

Make Classes Remember Their Variables?

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

Make Only Specific Functions And Variables Available?

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

Use Extract To Make Session Variables?

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

View 2 Replies

Make The Loop And Variable Variables Into A Function?

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

Make Multiple Pages In A Single Via Variables?

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

Get And Edit GET Variables In Order To Make Hyperlinks

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

Make PDOStatement->fetchObject Not Use Non Member Variables?

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

Make $_SESSION Variables A Global In A Function?

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

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

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

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

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

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

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

Copyrights 2005-15, All rights reserved