liontas Posted October 24, 2016 Share Posted October 24, 2016 The code : <?php global $connect; $connect= mysqli_connect('localhost', 'root','','andreas'); if (!$connect){ die('FAILED'. mysqli_error($connect)); } $the_post_id='46'; $query="SELECT * FROM posts WHERE post_id=$the_post_id "; $select_posts_by_id= mysqli_query($connect, $query); while($row= mysqli_fetch_assoc($select_posts_by_id)){ $post_title=$_row['post_title']; $post_keimeno=$_row['post_keimeno']; $post_publisher=$_row['post_publisher']; $post_cat_title=$_row['post_cat_title']; $post_image=$_row['post_image']; $post_date= $_row['post_date']; } var_dump($the_post_id); var_dump($select_posts_by_id); var_dump($row); var_dump($post_title); ?> The effect below: Notice: Undefined variable: _row in C:\xampp\htdocs\newstheme\admin\includes\test.php on line 18Notice: Undefined variable: _row in C:\xampp\htdocs\newstheme\admin\includes\test.php on line 19Notice: Undefined variable: _row in C:\xampp\htdocs\newstheme\admin\includes\test.php on line 20Notice: Undefined variable: _row in C:\xampp\htdocs\newstheme\admin\includes\test.php on line 21Notice: Undefined variable: _row in C:\xampp\htdocs\newstheme\admin\includes\test.php on line 22Notice: Undefined variable: _row in C:\xampp\htdocs\newstheme\admin\includes\test.php on line 23string(2) "46" object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int( ["lengths"]=> NULL ["num_rows"]=> int(1) ["type"]=> int(0) } NULL NULL What happens? Thanks a lot. Quote Link to comment Share on other sites More sharing options...
Solution benanamen Posted October 24, 2016 Solution Share Posted October 24, 2016 You have a handle of $row but are using $_row. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.