Page 1 of 2
error help please!
Posted: Wed Jul 30, 2003 11:27 pm
by nick2
everytime I try and register it tells me:
No database selected
heres my code:
Code: Select all
<?php
<?php
##Edit db details here##
$dbname = "slices_net";
$table_name = "tsusers";
$connection = @mysql_connect("localhost", "username" , "password")
or die(mysql_error());
##Stop editing db details##
$db = @mysql_select_db($db_name, $connection) or die(mysql_error() );
#
$sql = "INSERTINTO $table_name (ID, password, name, location, email, signature) VALUES ('$_POST[ID]',
password('$_POST[password]'), '$_POST[name]', '$_POST[location]', '$_POST[email]', '$_POST[signature]')";
#
$result = @mysql_query($sql,$connection) or die(mysql_error());
#
?>
?>
Posted: Wed Jul 30, 2003 11:32 pm
by jmarcv
Odd.
Looks good to me. You sure you have a slices_net?
Posted: Wed Jul 30, 2003 11:35 pm
by nick2
yes my main table is slices_net
Posted: Wed Jul 30, 2003 11:38 pm
by nielsene
Try removing the '@'s to stop the surpression of errors/warnings.
Posted: Wed Jul 30, 2003 11:40 pm
by nick2
nielsene wrote:Try removing the '@'s to stop the surpression of errors/warnings.
nope, same thing.
could it be because I made my fields .. maybe I made them wrong?
I dunno help!

Posted: Wed Jul 30, 2003 11:40 pm
by jmarcv
Good point nielsene
probably isn't even getting a connection. Missed that one.
Posted: Wed Jul 30, 2003 11:53 pm
by nick2
help me please... its not connecting to slices_net table why?!
Re: error help please!
Posted: Wed Jul 30, 2003 11:57 pm
by nielsene
Check the name of your db_name variables....
One place you use $dbname, another you use $db_name.... they are not the same, so you are selecting the database named "" (empty).....
Posted: Thu Jul 31, 2003 12:05 am
by jmarcv
Oh my god, nielsene
Thats 2! Must be the beer.
P.S. what's with the
>help me please... its not connecting to slices_net table why?!
I could almost feel the tears...
Posted: Thu Jul 31, 2003 12:11 am
by nick2
neisele it worked thanks bud!
one more problem:
You have an error in your SQL syntax near 'INSERTINTO trading (ID, password, name, location, email, signature) VALUES ('Nic' at line 1
Posted: Thu Jul 31, 2003 12:15 am
by jmarcv
Got that one! You need a space between the word INSERT and the word INTO.
Surely you noticed that?
Posted: Thu Jul 31, 2003 12:16 am
by nielsene
INSERTINTO ---> INSERT INTO
(missing a space)
Posted: Thu Jul 31, 2003 12:17 am
by nick2
what would I do without you guys?
thanks!!!!!!!!!!
Posted: Thu Jul 31, 2003 12:19 am
by jmarcv
uhh.... get another job?
dunno! Dats why we hea!
Posted: Thu Jul 31, 2003 12:35 am
by nick2
need ya again..
login related
I get parse error on line 19, which is } else { where in the code is it getting corrupted?
Code: Select all
<?php
<?php
$db_name = "slices_net";
$table_name = "trading";
#
$connection = mysql_connect("localhost", "slices", "thibault1")
or die(mysql_error());
#
$db = mysql_select_db($db_name, $connection) or die(mysql_error());
#
$sql = "SELECT * FROM $table_name WHERE ID = '$_POST[ID]' AND
password = password('$_POST[password]')";
#
$result = mysql_query($sql,$connection) or die(mysql_error());
#
$num = mysql_num_rows($result);
#
if ($num != 0) {
$msg = "<P>You're now logged in!</P>"
} else {
header("location: Http://slices.net/tradingsystem/login.php");
exit;
}
?>
?>