y do i get this error? Unknown column 'imagePath' in 'field list'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luke noob
    New Member
    • Aug 2009
    • 69

    #1

    y do i get this error? Unknown column 'imagePath' in 'field list'

    This acually happends to all fields, i have made sure that i have connected to the right database name, if i post my query (SELECT id, imagePath, titleOfTutorial , descriptionOfTu torial, tutorialBy FROM dogs ORDER BY id desc LIMIT 6) into mysql on phpMyAdmin it works fine and shows the data, but dosen't work on my web page, i dont understand whats happenin' here, i have google it but no luck,

    This is my code...

    [code=php]

    function getNewestTutori als() {
    require 'database.php';
    $q = "SELECT id, imagePath, titleOfTutorial , descriptionOfTu torial, tutorialBy FROM dogs ORDER BY id desc LIMIT 6";
    $result = $mysqli->query($q) or die(mysqli_erro r($mysqli));

    if($result) {



    while($row = $result->fetch_object() ) {

    $id = $row->id;
    $imagePath = $row->imagePath;
    $titleOfTutoria l = $row->titleOfTutoria l;
    $descriptionOfT utorial = $row->descriptionOfT utorial;
    $tutorialBy = $row->tutorialBy;

    print '<div id="pictureOfTo picAndTitle"> <!-- start pictureOfTopicA ndTitle -->

    <div id="pictureOfTo pic">
    <a href="view_tuto rial.php?id=' . $id . '">
    <img src="' . $imagePath . '" width="200" height="200">
    </a>
    </div>



    <div id="titleAndCon tent">
    <h2>' . $titleOfTutoria l . '</h2>

    <p>' . $descriptionOfT utorial . '</p>

    <div id="nameComment s">

    <p>Tutorial by ' . $tutorialBy . ', Comments 56</p>

    </div>
    </div>



    </div> <!-- end pictureOfTopicA ndTitle Div -->';


    }

    }
    }

    [/code]

    please help.
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    but dosen't work on my web page, i dont understand whats happenin' here
    Switch error reporting on.
    Do some error trapping and echo out variables.
    Study mysqli.

    Is $mysqli a link resource or a class object?
    Code:
    $result = $mysqli->query($q) or die(mysqli_error($mysqli));
    If you don't understand that question I suggest you study classes also.

    Comment

    Working...