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.

Recommended Answers

All 6 Replies

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");

Changed "," same error

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

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);
	?>

Sorted, thanks. Wrong table name

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.