Please help... I a completely new to PHP and mysql. I am using PHPmagic to construct a web database for community use events etc... when I generate the code and place on the website it doesn't want to work. Below is the error I recieve when accessing page: http://www.csweb.net/php_test/setup/setup.php

As I understand it this is the page created to setup the database for mysql. Anyway, any thoughts or help would be greatly appreciated.

The error is:

Parse error: syntax error, unexpected T_STRING in D:\csweb\PHP_test\setup\setup.php on line 3

Here is the code generated by phpmagic

<?php

error reporting(E_ALL ^ E_NOTICE);

// This script and data application were generated by PHPMagic 1.1 on 4/29/2005 at 1:42:00 AM
// Download PHPMagic for free from http://www.websitedatabases.com/

include("../language.php");

include("./lib.php");

if(!@mysql_connect("localhost", "root", "xxxx"))
{
echo $Translation["error while connecting to mysql:"] . mysql_error();
exit;
}
echo str_replace("<DBName>", "RSOD", $Translation["attempting to create db"]) . "<br>";
if(!@("create database if not exists RSOD"))
{
echo $Translation["error while creating db"] . mysql_error();
echo "<br>" . str_replace("<DBName>", "RSOD", $Translation["please make sure username has permissions"]);
}
mysql_close();
echo "Done ... <br>";

// create table 'table1'
echo str_replace("<TableName>", "table1", $Translation["attempting to create table"]);
sql("create table if not exists table1 ( field1 TEXT primary key, field2 MEDIUMBLOB , field3 TEXT , field4 INT )");
echo $Translation["done"] . "<br>";

echo "<br>" . $Translation["finished setup"] . "<br>";
echo $Translation["to access your db"];
?>

    It should be "error_reporting", not "error reporting";

      when I use error_reporting

      it just comes up a blank page

      Any thoughts?

      Thanks

        It might be something in one of the included files causing the script to exit.

        As a suggestion, btw, I'd say change "errror_reporting(error reporting(E_ALL ^ E_NOTICE);" to "error reporting(E_ALL);" and remove the "@" signs. You'd be liable to get more information that way, and you can change it back when the script is ready for production.

          Thank you very much the information is helpful...

          I followed you suggestions and I think it may have been related to no username/password entered in one of the files.

          Now I am getting a different error message perhaps you could point me the right direction 🙂

          Fatal error: Call to undefined function mysql_connect() in D:\csweb\PHP_test\setup\setup.php on line 11

          here is the script around line 11

          if(!mysql_connect("localhost", "root", "mypassword"))
          {
          echo $Translation["error while connecting to mysql:"] . mysql_error();
          exit;
          }

            Write a Reply...