Jump to content

whats wrong with my WHERE clause ?


ricky spires

Recommended Posts

hello.

 

i have a column called "pageName" and on the each page i have put $pName = "the name of that page".

 

i want to pull from the database all the information where the $pName on the page is the same as the pageName in the database

 

its getting the $pName = "adminHome" but it thinks its the name of the column not the row.

 

this is the error im getting:

 

DATABASE.PHP - confirm_query = MySQL Datatbase Query Failed: Unknown column 'adminHome' in 'where clause'

 

Last SQL query: SELECT * FROM pages WHERE pageName=adminHome

 

 

this is the function code

public static function find_by_pageName($pName=""){
	global $database;
	$sql = "SELECT * FROM ".self::$table_name." WHERE pageName=".$database->escape_value($pName)."";
	$result_array = self::find_by_sql($sql);
	return !empty($result_array) ? array_shift($result_array) : false;
}

 

 

this is the page code

<?PHP
require_once("../includes/initialize.php");

$pName = "adminHome";

$page = Pages::find_by_pageName($pName);
?>

 

 

thanks

rick

Link to comment
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.