The TRshady Forum became read-only in December 2014. The 10 year history will live on, in this archive.
Continue the discussion with the new home for the Eminem and Hip Hop discussion: HipHopShelter.com.

[PHP] Createing Mysql Tables with Include...Help

Talk and get help on Webmaster related topics such as programming, designing and advertising.
See WhoNeedsActions.com for Web Development Guides.

[PHP] Createing Mysql Tables with Include...Help

Postby dave » Jul 18th, '08, 17:06

I've posted this in other forums more suited for it but didn't get a reply, so i decided to post it on the BEST forum :smoking: :D anyways....

I Have two files one containing the user information for the MySql etc (File 1),
and one trying to create tables using that information (File 2).

File 1:
Code: Select all
<?php
$mysqlhost = 'localhost';
$mysqlname = 'dbname';
$mysqluser = 'user';
$mysqlpass = 'mypasswd';
$conn = mysql_connect('localhost', 'user', '') or die ('Cant Conect to MySQL server');
$db = mysql_select_db('dbname', $conn) or die ('Cant Select Database');
?>


File 2 :
Code: Select all
<?php
include('../other/info.php');
mysql_query("CREATE TABLE customer
(name VARCHAR(15), post VARCHAR(255))");
?>


When I run the above, the tables are not created and I'm just given a blank page.

:'( :angry: According to books I have, and many websites I've been to, this should be working.

Whats wrong?
Image

I Hate PhpBB3, Avatars On The Other Side WTF!! Skining on phpbb2 is much better
Say No Fascism, Dont get Vista
User avatar
dave
Soldier
Soldier
 
Posts: 541
Joined: May 1st, '06, 20:10
Location: UK
Gender: Male

Re: [PHP] Createing Mysql Tables with Include...Help

Postby dave » Jul 18th, '08, 21:32

I have fix the problem now it was due to the lack of double quotes in the first file
it was...
Code: Select all
$conn = mysql_connect('localhost', 'user', 'pass')

and it should of been
Code: Select all
$conn = mysql_connect("localhost", "user", "pass")
Image

I Hate PhpBB3, Avatars On The Other Side WTF!! Skining on phpbb2 is much better
Say No Fascism, Dont get Vista
User avatar
dave
Soldier
Soldier
 
Posts: 541
Joined: May 1st, '06, 20:10
Location: UK
Gender: Male

Re: [PHP] Createing Mysql Tables with Include...Help

Postby C-Game » Jul 24th, '08, 18:23

ahh cool ur doin php man.. fuckin hate it..

ya those kinda errors are da most annoyin to find...
User avatar
C-Game
Band Leader
Band Leader
 
Posts: 7930
Joined: Jul 24th, '06, 19:02
Location: THRONE of the KING OF KINGS
Gender: Male


Return to Webmaster World



Who is online

Users browsing this forum: No registered users