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.

Link to comment
Share on other sites

$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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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