0

I've got a php script which queries mysql for a certain row based on it's id.

This works fine for the first 3 rows , but on the 4th it returns nulls on all fields.

Here's the query:

mysql_query("SELECT ind,title,body,img,tags,live FROM project WHERE ind = '".$curid."' ")

let me know if you need to see more code.

1
  • Probably because ind is never that value of $curid. Print out the values of $curid to verify. Commented Feb 8, 2012 at 13:25

3 Answers 3

2

I'm going to take a guess that the forth row doesn't have the id you think it does. Return them all (remove the where statement) and output them to the screen to check, or use a database browsing tool, if you have one.

Sign up to request clarification or add additional context in comments.

Comments

0

Try some debugging..

$q = "SELECT ind,title,body,img,tags,live FROM project WHERE ind = '".$curid."' ";
$rs = mysql_query($q) or die("MySQL error in Query: ". $q ."<br><br>The error is:<br>".mysql_error());

Comments

0

when you execute query, change $curid by value that you consider is correct. verify result, if yet get null values, you can do it:

mysql_query("SELECT ind,title,body,img,tags,live FROM project WHERE ind = '".$curid."' " and
ind  IS NOT NULL and title IS NOT NULL 
)

for example

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.