Jump to content

Error in code?


eduard

Recommended Posts

What´s wrong with this code (creating a table)?<html><body><?php$con = mysql_connect("localhost","root","root");if (!$con) { die('Could not connect: ' . mysql_error()); }// Create databaseif (mysql_query("CREATE DATABASE Products",$con)) { echo "Database created"; }else { echo "Error creating database: " . mysql_error(); }// Create tablemysql_select_db("Products", $con);$sql = "CREATE TABLE Articles(Price intQuantity int)";// Execute querymysql_query($sql,$con);mysql_close($con);?></body></html>

Link to comment
Share on other sites

Follow my instructions from this topic and you'll see an error message that will be of assistance.I'm talking about the part

fine, search the MAMP folder for "php.ini". Open every file found. Do steps from 3 on.
Link to comment
Share on other sites

Follow my instructions from this topic and you'll see an error message that will be of assistance.I'm talking about the part
I did that, but such a folder doesn´t exist!bincgi-binconfdbhtdocsLEAME.rtfLibrarylicencesLIESMICH.rtfLISEZ-MOI.rtflogsMamp Control.wdgtMAMPREADME.rtftmpпрочти.rtfお読みください.rtf
Link to comment
Share on other sites

Search for a file named "php.ini" in any of those folders. It will most likely be somewhere in the "conf" folder, but that's not certain.

Link to comment
Share on other sites

What´s wrong with this code (creating a table)?<html><body><?php$con = mysql_connect("localhost","root","root");if (!$con) { die('Could not connect: ' . mysql_error()); }// Create databaseif (mysql_query("CREATE DATABASE Products",$con)) { echo "Database created"; }else { echo "Error creating database: " . mysql_error(); }// Create tablemysql_select_db("Products", $con);$sql = "CREATE TABLE Articles(Price intQuantity int)";// Execute querymysql_query($sql,$con);mysql_close($con);?></body></html>
are you following the tutorials?http://www.w3schools.com/php/php_mysql_create.aspCan you see what is wrong with your table create code and theirs?
$sql = "CREATE TABLE Persons(FirstName varchar(15),LastName varchar(15),Age int)";

Link to comment
Share on other sites

Search for a file named "php.ini" in any of those folders. It will most likely be somewhere in the "conf" folder, but that's not certain.
Found it! (conf > php5.2)
Link to comment
Share on other sites

Yes, that's one of the files. As I said, follow the steps from 3 on in that topic... don't make me write them again.And see if you can find the PHP 5.3 one, and do the same with it.

Link to comment
Share on other sites

Yes, that's one of the files. As I said, follow the steps from 3 on in that topic... don't make me write them again.And see if you can find the PHP 5.3 one, and do the same with it.
It doesn´t work!"error_reporting = "
Link to comment
Share on other sites

It doesn´t work!"error_reporting = "
without the quotes?(I can see it in the text you pasted... it's there)
Link to comment
Share on other sites

without the quotes?(I can see it in the text you pasted... it's there)
It works, but I don´t succeed!I´ll come back to you tomorrow!
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...