Jump to content

php with mysql


redarrow

Recommended Posts

advance thank you...

 

i am currently learning how to do php with mysql so i dont need to use the mysql

console but the table dosent go on the database..

 

please help cheers..

 

no errors just the table dosent create cheers....

 

 

 

<?php


$db=mysql_connect(" sec"," sec"," sec");

$query='CREATE DATABASE database_test';

$result=mysql_query($query)or die('<center><b>Database exists please delete database or change database name</b></center>');

mysql_select_db('database_test',$db)or die('could not select database');

$query2='CREATE TABLE members('.
                              'id INT NOT NULL AUTO_INCREMENT'.',PRIMARY_KEY(id))';

$result2=mysql_query($query2)or die("Table error");

echo"database created and tables";

mysql_close($db);

?>



 

 

 

Link to comment
https://forums.phpfreaks.com/topic/76196-php-with-mysql/
Share on other sites

tried it this way aswell but no luck the table wont create....

 

<?php

// database connection...

// 1. Conection  2. Username 3. Password

$db=mysql_connect("sec","sec","sec");

// 1. The $query 2. CREATE DATABASE 3. databse name

$query='CREATE DATABASE database_test';

$result=mysql_query($query)or die('<center><b>Database exists please delete database or change database name</b></center>');

mysql_select_db('database_test')or die('could not select database');

$query='CREATE TABLE members ('.
                              'id INT NOT NULL AUTO_INCREMENT,'.' PRIMARY_KEY(id))';

$result=mysql_query($query)or die("Table error");

echo"database created and tables";

mysql_close($db);

?>

Link to comment
https://forums.phpfreaks.com/topic/76196-php-with-mysql/#findComment-385597
Share on other sites

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.