php - learning how to read data from MYSQL -


i'm trying learn php , mysql, trying read data database following online , encounter error(s) here code

<?php   include 'includes/conn.php';     $query =sprintf("select * customer");    $result = mysql_query($query);     if (!$result)     {    $message  ='from see it's not connecting!'.mysql_error() ."\n";       $message .= 'everything' .$query;       die($message);    }         while ($customer = mysql_fetch_assoc($result))     {        echo $row['cust_id'];        echo $row['fname'];        echo $row['lname'];        echo $row['gender'];        echo $row['dob'];     } mysql_free_result($result); ?> 

//this trying make connection database

<?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = '';  $db ='telmar_php'; $con = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($db); ?> 

replace

$message  ='from see it's not connecting!'.mysql_error() ."\n"; 

here string single quotation marks in it's causing problem

with

$message  ="from see it's not connecting!".mysql_error() ."\n"; 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -