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
https://forums.phpfreaks.com/topic/248012-whats-wrong-with-my-where-clause/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.