John Davidson

html - Can't retrieve data from table php


I have created a button on my HTML page that is supposed to retrieve data from my table. However, when I click on it, no Data seems to be showing. Here is my table (artists):

      name      | Style |  
Micheal Jackson | Pop
Tyga | Rap
Drake | Rap
50 cent | Rap
King Von | Rap

I am trying to print the name column but does not seem to be working? It shows a blank page. Here is my code:

<!DOCTYPE html>
<html lang="en">
<title>Artists Table</title>
<meta charset="utf-8">
<meta name="Author" content="Ron Mercer">

<h1>Players Table</h1>


$con=pg_connect("dbname=ron") or die( pg_last_error());
$res = pg_query_params("select name from artists where name= $1",array($name))
or die( pg_last_error());

while ($row = pg_fetch_row($res))


I know that there is a good connection to my database because when I spell type my table name(artists) wrong it says:

ERROR: relation "artisgsts" does not exist LINE 1: select name from artisgsts where name= $1 ^.

So it recognises my table, but why doesn't it print anything? Thanks.

My Answer:
you please provide more context or specify what you would like to know about HTML?

Rate this post

4 of 5 based on 1826 votes


© 2024 - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us