Getting from $result to $user1 in a php SQL statement
How do you get $user1 from $result even if null?
Text1 and Text2 are from the submit button from login.php and they do exist.
I have a MySQL database: db12345, table: login, and columns: idl, secid and username.
$id = filter_input(INPUT_POST, "Text1");
$sec= filter_input(INPUT_POST, "Text2");
$conn = mysql_connect('server.com', 'dbo12345', 'pass1');
$sql = "SELECT `username` FROM `login` WHERE idl=".$id." And secid=".$sec.";";
$result = mysql_query($sql, $conn);
Last edited by NogDog; 06-28-2014 at 12:50 PM.
Reason: fixed syntax error in code (missing quote)
$result will be a query result resource if successful, otherwise FALSE. You'll have to use one of the mysql_fetch_*() function to read a result row from that resource. Of course, you really shouldn't be using the deprecated mysql_*() functions at all, instead either using the MySQLi or PDO database extensions.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)