php mysql syntax help?

Bat

New member
basically i get the following error returned
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1" and my code is
"
<?php

include'conn.php';


$value=$_post['usid'];

$query="SELECT * FROM users WHERE uid =$value ";
$result = mysql_query($query) or die(mysql_error());


$info = mysql_fetch_array($result);

$id = $info['UID'];
$name = $info['username'];
$pass = $info['password'];


echo '<br>';
echo '<table border="1">';
echo '<tr><td>ID:</td>';
echo '<td>';
echo $id;
echo '</td><br>';
echo '<td>username:</td><td>';
echo $name;
echo '</td>';
echo '<td>password:</td><td>';
echo $pass;
echo '</td>';

?>"

how ever when the script has a set id to lookup it works fine so im a bit confused I.e this works
"
<?php

include'conn.php';


$value=1;

$query="SELECT * FROM users WHERE uid =$value ";
$result = mysql_query($query) or die(mysql_error());


$info = mysql_fetch_array($result);

$id = $info['UID'];
$name = $info['username'];
$pass = $info['password'];


echo '<br>';
echo '<table border="1">';
echo '<tr><td>ID:</td>';
echo '<td>';
echo $id;
echo '</td><br>';
echo '<td>username:</td><td>';
echo $name;
echo '</td>';
echo '<td>password:</td><td>';
echo $pass;
echo '</td>';

?>"

and the form elements name is usid any help will be great
 
I think post should al be in capital letters: $_POST['.....']. And also try to use include with parenthesis: include('.....');
 
Back
Top