MySQL Forums
Forum List  »  Newbie

query question
Posted by: Tom Smith
Date: March 24, 2012 10:55AM

Here is my problem... echo "$userx"; provides me with correct username from my database e.g. tom1, but when I do query I got no results... if I replace '$userx' with "tom1" all works fine..
Very appreciate your help..

<?php

$user_report_A = $_POST['user_report_A'];

$userx = "$user_report_A" ;
echo "$userx";

include 'db.php';
$query = "Select * FROM database WHERE username = '$userx'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array( $result);


$user_first_name = $row['first_name'];
$user_last_name = $row['last_name'];


echo "$user_first_name";

?>

Options: ReplyQuote


Subject
Written By
Posted
query question
March 24, 2012 10:55AM
March 26, 2012 12:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.