0

I know there are many other threads about this same error, but none have helpped me, here is my code:

<?php
		$mysql_id = mysql_connect('mysql3.000webhost.com', 'a2778852_556875', 'pendolino390');
	mysql_select_db('a2778852_555676', $mysql_id);
	
	$result = mysql_query("SELECT personalexperience, sex, age, sexuality, FROM Personal_experience");
	
	
	while($row = mysql_fetch_array($result))
	  {
	  echo $row['personalexperience'], $row['sex'], $row['age'],  $row['sexuality'];	 
	  }
	  
	  mysql_close($mysql_id);
	?>

Any help will be much appreciated, thanks.

4
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by Stefano Mtangoo
0

I know there are many other threads about this same error, but none have helpped me, here is my code:

<?php
		$mysql_id = mysql_connect('mysql3.000webhost.com', 'a2778852_556875', 'pendolino390');
	mysql_select_db('a2778852_555676', $mysql_id);
	
	$result = mysql_query("SELECT personalexperience, sex, age, sexuality, FROM Personal_experience");
	
	
	while($row = mysql_fetch_array($result))
	  {
	  echo $row['personalexperience'], $row['sex'], $row['age'],  $row['sexuality'];	 
	  }
	  
	  mysql_close($mysql_id);
	?>

Any help will be much appreciated, thanks.

You have to delete , after sexuality.

New code:

$result = mysql_query("SELECT personalexperience, sex, age, sexuality FROM Personal_experience");
0

Changed "," same error

There can be problem with this:

1. wrong table name
2. failed to connect to database server
3. failed to select database

0

try adding or die() to get more details about the error:

<?php
		$mysql_id = mysql_connect('mysql3.000webhost.com', 'a2778852_556875', 'pendolino390') or die( sprintf('Line %d: %s',__LINE__, mysql_error() ) );
	mysql_select_db('a2778852_555676', $mysql_id) or die( sprintf('Line %d: %s',__LINE__, mysql_error() ) );
	
	$result = mysql_query("SELECT `personalexperience`, `sex`, `age`, `sexuality` FROM `Personal_experience`") or die( sprintf('Line %d: %s',__LINE__, mysql_error() ) ) ;
	
	
	while($row = mysql_fetch_assoc($result))
	  {
	  echo $row['personalexperience'], $row['sex'], $row['age'],  $row['sexuality'];	 
	  }
	  
	  mysql_close($mysql_id);
	?>

Edited by hielo: n/a

This topic has been dead for over six months. 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.