If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > $ sign problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-10, 06:15
don_log don_log is offline
Registered User
 
Join Date: Jun 2008
Location: pakistan
Posts: 109
$ sign problem

i make a installation process of script like vbulletin and others forum it write all the information to the file and i use this script but when i write here $ sign it give me error undefined variable in this line ...

so how to write replace function of php that it will replace any sign in $ sign

PHP Code:
$school_nam=$_POST['sname'];
$school_desc=$_POST['sdesc'];
$db_host=$_POST['dbhost'];
$db_nam=$_POST['dbname'];
$db_use=$_POST['dbuser'];
$db_pas=$_POST['dbpass'];
$admin_user=$_POST['auser'];
$admin_pass=$_POST['apass'];
$file="../prunner/vars.php";
$fh=fopen($file,'w');
$string="<?php &amp;host_name='$db_host'; &amp;db_name='$db_nam'; &amp;db_user='$db_use'; &amp;db_pass='$db_pas'; &amp;school_name='$school_nam'; &amp;school_desc='$school_desc'?>";
$writeit=fwrite($fh,$string);
if(!$writeit){
    echo "Some Files Missing Contact Us";
    echo "<FORM> ";
echo "<INPUT type='button' value='Close Window' onClick='window.close()'> ";
echo "</FORM>"; 
}
else{
    echo "File Writing Successfully Now You Will Be Redirected To Step 2";
}
fclose($fh);
&amp; replace in $ sign any way to replace then please make this script correct and post it so i can easily do this work
Reply With Quote
  #2 (permalink)  
Old 06-22-10, 07:37
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
suggest you build your string sequentially then examines the value of Sstring
this will help you understand precisely where the scirpt is failing

eg

$string = "<?php &amp;";
$string .= "host_name='$db_host';&amp;";
$string .= "db_name='$db_nam'; &amp;";
$string .= "db_user='$db_use'; &amp;";
$string .= "db_pass='$db_pas'; &amp;";
$string .= "school_name='$school_nam'; &amp;";
$string .= "school_desc='$school_desc';";
$string .= " ?>";

however my suspisicion is that the PHP parser will not like the <php at the start of $string and the ?> may tell PHP to stop parsing any further code as PHP

again developoing better debugging skills will help you identify where the fault is being reported
$writeit=fwrite($fh,$string);
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 06-26-10, 05:57
don_log don_log is offline
Registered User
 
Join Date: Jun 2008
Location: pakistan
Posts: 109
Thanks dude
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On