Jump to content

Recommended Posts

if i run the following code as is, i see all the echos up to the /* operate normally. if i move the /* down two lines, so that it is in front of the query, the browser can see nothing. if i get rid of the /* and the */, still nothing, not even the fail message. i am running this on my server, i have created tables in this manner before without any trouble. i know my personal information is in there, i don't care, its just a practice site. in fact you can log in yourself and try it if u like.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Patrick Allard's Very Graphic Website</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<p>
html working
<?php

define("DB_SERVER", "sql307.000space.com");
define("DB_USER", "space_4826174");
define("DB_PASS", "omgtkkyb");
define("DB_NAME", "space_4826174_loginsystem");

echo DB_SERVER;
echo DB_USER;
echo DB_PASS;
echo DB_NAME;

$con = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME, $con) or die(mysql_error());

$q="CREATE TABLE users (
username varchar(30) primary key,
password varchar(32),
userid varchar(32),
userlevel tinyint(1) unsigned not null,
email varchar(50),
timestamp int(11) unsigned not null
);";

echo $q

/*
$result = mysql_query($q, $con);
//error is in the line above, if you move the star slash down two lines, the browser cannot see anything

if(!$result)
{
   echo "failure" . mysql_error();
}
else
{
   echo "table created";
}


*/
?>
</p></body></html>

there appears to be a fatal error happening. Try turning error reporting on

(put this at the TOP of the page)

error_reporting(E_ALL);
ini_set("display_errors", 1);

 

but the problem is here

echo $q

there is no semi colon after that line. it should be

echo $q;

 

turning on error reporting will help find simple errors like that

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.