Get support from Xavier Media
It is currently Sun Dec 08, 2013 12:26 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: help .... (var)
PostPosted: Tue Oct 10, 2006 1:19 pm 

Points:
hi ...

plz i want help
if i have 2 pages of php
like (page1.php and page2.php) and i have in
page1.php (var)$db ="photoshop"and
in page2.php i have the same (var) $db
i want how can i give to the (var)$db in page2.php the same value i gave it to (var)$db in page1.php i will put code for examlpe

Code:
page1
print "<div style=\"position: absolute; width: 211px; height: 89px; z-index: 1; left: 15px; top: 345px\" id=\"layer1\">";print "<form method=\"$_post\" action=\"page2.php\"></p>  ";

print "<p align=\"center\"><select size=\"1\" name=\"id\">";
$db = "photoshop";
$check1 = "select filename from $db";
$Result = mysql_query($check1);
while ($row = mysql_fetch_array($Result))
{
print("<option>".$row[filename]."</option>");
}
print ("</select>");
print "<p align=\"center\"><input type=\"submit\" value=\"Preview\" name=\"\" style=\"width: 60; height: 23; color: #FFFFFF; border: 0 solid #000000; background-image: url('../images/send.jpg'); background-repeat: repeat-x\"></div></p>

</form>";
print "</div> ";


Code:
page2
$check = "select filelink from $db where filename ='$id'";
$Result = mysql_query($check);
while ($row = mysql_fetch_array($Result))
{
$link = $row[filelink];
}


plz anyone can help me .............


Report this post
Top
  
Reply with quote  
 Post subject: Global
PostPosted: Tue Oct 10, 2006 2:49 pm 

Points:
When it comes to databases or variables I want in several pages I make a separate page for them:



vars.php
[php]<?php

$var1 = "DB Name";
$var2 = "Hello";
$var3 = "39fmdi5l2ksd";
$var4 = "password";

?>[/php]


And then on each page I include the file:

page1.php
[php]<?php
include("vars.php");
...
echo $var1;
...
?>[/php]


page2.php
[php]<?php
include("vars.php");
...
echo $var4;
...
?>[/php]

Your other choice is to make variables GLOBAL.
Let me know if you still need help. :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: Tue Oct 10, 2006 4:49 pm 

Points:
Thankx davied for your help
really i am trying global var from some time but it's dosen't work with me i don't know why !!!
anyway thankx for your help i will try that way hope it will work :)
and about global i will look for that link u put it thankx agein


Report this post
Top
  
Reply with quote  
 Post subject: phpinfo global
PostPosted: Tue Oct 10, 2006 5:10 pm 

Points:
In order for Global variables to work your server has to have them enabled. The easiest way to check is to run a phpinfo(); script:

phpinfo.php
[php]<?php
phpinfo();
?>[/php]

Then scroll down and see if you're PHP install has Globals turned on...

Many servers have them turned off because they can pose a threat to your site. A hacker can pass a page a variable that contains bad code. That is way I keep my variables in a page and just include them. :wink:

You might also find this helpful:
http://phptutorialsite.com/scope-in-php.htm


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Registered users: No registered users


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Portal » Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
[
SEO MOD © 2007 StarTrekGuide ]