Problem with error?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Skywalker
Forum Contributor
Posts: 117
Joined: Thu Aug 29, 2002 3:33 am
Location: The Netherlands

Problem with error?

Post by Skywalker »

You have an error in your SQL syntax near '' at line 1


THIS LINE ONE <?php require_once('Connections/Verbinding.php'); ?>



<?php
$Table = $_POST['Pakket'];

mysql_select_db($database_Verbinding, $Verbinding);
$query_Recordset1 = "SELECT Username,Password FROM $Table";
$Recordset1 = mysql_query($query_Recordset1, $Verbinding) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);



$Password = $_POST['Password'];
$Username = $_POST['Username'];

$Found = 0;
do {
If($Password == $row_Recordset1['Password'] && $Username == $row_Recordset1['Username']) {
$Found = 1;
}
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));

if ($Found == 1)
echo ("Login gegevens zijn corect <META HTTP-EQUIV=\"refresh\" content=\"2;URL=virtual-home.htm\"><br>\n");
else
echo ("Login gegevens zijn niet corect <META HTTP-EQUIV=\"refresh\" content=\"2;URL=index.htm\"><br>\n");


?>
User avatar
~J~R~R
Forum Newbie
Posts: 20
Joined: Wed Sep 18, 2002 12:19 pm
Location: Amsterdam, the Netherlanda

Post by ~J~R~R »

Line 1 means line 1 of your query. Are you sure $Table has a correct value? Check it with an echo.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Also do you have the columns that you have specified?
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

try putting $table in ' s
i always thought that you could put variables in queries without having them in inverted commas... but i tried it last night myself and it didnt work...
Post Reply