Jump to content

[SOLVED] script won't work, creating a php file


XpertWorlock

Recommended Posts

$Content = ("

<?php

include 'siteLayout.php';

$con = mysql_connect('localhost:2222',"******","********");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("*********", $con);

$result = mysql_query("SELECT * FROM users");
while($row = mysql_fetch_array($result))
  {
  echo $row['userName'];
  }

mysql_query(\"INSERT INTO users (userName, userPassword, userEmail) 
VALUES ('$signUpName', '$signUpPassword', '$signUpEmail')\");

echo \"<table border='1'><tr><td>
Your account has been activated.<br><br>Please log in.
</td></tr></table>\";
?>

\r\n"); 

$handle = fopen($fileName, 'x+'); 
fwrite($handle, $Content); 
fclose($handle); 

 

 

$con = mysql_connect('localhost:2222',"*******","*********");

 

This is the part of code where the error comes up.  "Unexpected T_STRING."

$Content is the content of the php file being written.

 

Help is appreciated, I've tried everything I could think of.

$Content = ("

<?php

include 'siteLayout.php';

$con = mysql_connect('localhost:2222','*****','********');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db('********', $con);

$result = mysql_query("SELECT * FROM users");
while($row = mysql_fetch_array($result))
  {
  echo $row['userName'];
  }

mysql_query("INSERT INTO users (userName, userPassword, userEmail) 
VALUES ('$signUpName', '$signUpPassword', '$signUpEmail')\");

echo \"<table border='1'><tr><td>
Your account has been activated.<br><br>Please log in.
</td></tr></table>\";
?>

\r\n"); 

$handle = fopen($fileName, 'x+'); 
fwrite($handle, $Content); 
fclose($handle); 

 

Sorry I was copying an example of the code, I actually just use a function, so I now copied the official function.  Again it's

$result = mysql_query("SELECT * FROM users");

that gives the T_STRING error

 

thanks for the replies so far

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.