Jump to content

Recommended Posts

Hi, I am trying to display data from a table in mysql with the following code, however when the page loads it just shows lines of '=='. Everything is spelt correctly and there is data in the table.

 

<?php

$connection = mysql_connect("localhost", "root");


mysql_select_db("people", $connection);


   	$query = "SELECT * FROM customer"; 
   
   	
   	$result = mysql_query ($query); 

  	
   	while ($row = mysql_fetch_array($result)) 
   	{  
     	  print $row["customerID"]; 
     	  print "=="; //print 2 equals signs 
     	  print  $row["surname"]. "<br>";  
  	 }
?>

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/184728-why-is-this-code-not-working/
Share on other sites

if you are seeing lots of "==" then you are connecting okay. So then it can only be:

 

a) you said you double checked and you spelled the column names correctly.  This is the most common cause of bug.  Double check.  Make sure you capitalized correctly (case-sensitive!).  print_r($row); in the loop to dump out what is in $row

b) are you using the right table name?

c) are you using the right database?

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.