elis Posted September 22, 2008 Share Posted September 22, 2008 I have this PHP snippet: <?php $sql = "SELECT resume_id, resume_filename FROM candidateResumes WHERE candidate_id = :cid"; $stmt2 = $conn->prepare($sql); $stmt2->bindParam(':cid', $id); $stmt2->execute(); $resumes = $stmt2->fetchAll(); $stmt2->closeCursor(); if($resumes) { echo ('available'); } else { echo ('empty return');} ?> But for some reason, it's returning as if nothing exists. I've checked the MYSQL table that it's pulling from and it does exist, so I'm assuming I have an problem in my syntax. edit: ":cid and $id are variables from a $_GET statement. The entire script (not just this snippet) runs from the same $_GET statement and everything else that operates from it works, so I'm almost certain it's not that.) Link to comment https://forums.phpfreaks.com/topic/125333-spot-the-problem-sql-grab-failing/ Share on other sites More sharing options...
pocobueno1388 Posted September 22, 2008 Share Posted September 22, 2008 What is ":cid"? I don't know why your putting a colon in there, I think you mean for it to be "$cid". Link to comment https://forums.phpfreaks.com/topic/125333-spot-the-problem-sql-grab-failing/#findComment-647820 Share on other sites More sharing options...
elis Posted September 22, 2008 Author Share Posted September 22, 2008 Colons are used for prepared statements. Link to comment https://forums.phpfreaks.com/topic/125333-spot-the-problem-sql-grab-failing/#findComment-647822 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.