Jump to content

[SOLVED] SELECT query not working


dolcezza

Recommended Posts

The error I am getting is "Error: Unknown column 'Susan' in 'where clause'"

The first name entered into the database is Susan.

The values are all showing up in the database.

Any ideas? Any help greatly appreciated.

 

 

$query = mysql_query("INSERT INTO caregivers (firstname, lastname, email, phone, county, experience, date) VALUES ('$firstname', '$lastname', '$email', '$phone', '$county', '$experience', '$date')") or die(mysql_error());
$getrow = mysql_query("SELECT caregivers_id from caregivers where firstname=$firstname and lastname=$lastname")or die ('Error: '.mysql_error ());


if($query)
{

$row=mysql_fetch_array($getrow,MYSQL_ASSOC);
$id=$row['id'];

?>

Link to comment
https://forums.phpfreaks.com/topic/81299-solved-select-query-not-working/
Share on other sites

this

 

SELECT caregivers_id from caregivers where firstname=$firstname and lastname=$lastname

 

should be

SELECT caregivers_id from caregivers where firstname='$firstname' and lastname='$lastname'

 

notice the single quotes you missed them out

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.