Jump to content

Recommended Posts

Im banging my head against the wall on this one.  Im almost positive I have my array setup properly but Im getting this error

 

Notice: Use of undefined constant type - assumed 'type' in C:\wamp\www\test\test.php on line 22

Notice: Use of undefined constant Model - assumed 'Model' in C:\wamp\www\test\test.php on line 23

Notice: Use of undefined constant purchased - assumed 'purchased' in C:\wamp\www\test\test.php on line 24

Notice: Use of undefined constant stats - assumed 'stats' in C:\wamp\www\test\test.php on line 25
Dell LX 4700

 

 

Here is the code it is referring to:

..ommitted the db select vars..
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_select_db($db) or die ("Unable to select database!");

// create queries will select all data in database and display it as listed
$queryn =  "SELECT type, Model, purchased, purchaser, stats FROM hardware";

$result = mysql_query($queryn) or die ("Error in query: $query. ".mysql_error());
if (mysql_num_rows($result) > 0) {

//begin while loop
while($row = mysql_fetch_assoc($result)) {

//set image variables
$one = $row[type];
$two = $row[Model];
$three = $row[purchased];
$four = $row[stats];
/* echo image table for testing only! ommit this line if images ar enot showing up, if the images dont show up after omission then there is an error with the MySQL database and or connection */

// THIS IS WHAT IS DISPLAYED ON THE WEBSITE

echo $one.$two.$three.$four; 

/*****************************************/
  
  } 

}
else {
    // no
    // print status message
    echo "Sorry fella, nothing left";
}

// free result set memory
mysql_free_result($result);


?>

 

any help on this would be greatly appreciated!

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/169240-notice-use-of-undefined-constant/
Share on other sites

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.