0

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

2
Contributors
3
Replies
14
Views
1 Year
Discussion Span
Last Post by janicemurby
0

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?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.