hi i got another syntax error in a script that i am fixing to add onto my main site can someone take a look to see whats going off
this error is
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and main_image = '1'' at line 1
but in my coding for that section it has the following

<?php $user_image    = mysqli_query($conn, "select * from user_images where user_id = ".$userid." and main_image = '1' ")or die //error line
(mysqli_error($conn));
    exit();
$fetch_image = mysqli_fetch_array($user_image);

if($fetch_image['user_image']!='') {
       echo '<img  src="../images/user_images/' . $fetch_image['user_image'] .'"height="100px;" width="100px;"/><br/>';
}else { 
      echo '<img  src="../images/blank_big.jpg" height="100px;" width="100px;"/><br/>';
} ?>

any help would be much appreciated and ty again

You probably need single quotes around $userid like what you did with main_image. Next question. What is the definition of this table. IE, what types are user_id and main_image?

user id is int
and main image is int

if thats what you mean hun

sorted ty it was the single quotes needed :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.